private ensureCache()

in client/src/yaml-support/yaml-locator.ts [98:111]


	private ensureCache(key: string, textDocument: vscode.TextDocument): void {
		if (!this.cache[key]) {
			this.cache[key] = <YamlCachedDocuments>{ version: -1 };
		}

		if (this.cache[key].version !== textDocument.version) {
			// the document and line lengths from parse method is cached into YamlCachedDocuments to avoid duplicate
			// parse against the same text.
			const { documents, lineLengths } = parse(textDocument.getText());
			this.cache[key].yamlDocs = documents;
			this.cache[key].lineLengths = lineLengths;
			this.cache[key].version = textDocument.version;
		}
	}