MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / provideTextDocumentContent

Method provideTextDocumentContent

Extension/src/main.ts:50–60  ·  view source on GitHub ↗
(uri: vscode.Uri)

Source from the content-addressed store, hash-verified

48 // Register a protocol handler to serve localized versions of the schema for c_cpp_properties.json
49 class SchemaProvider implements vscode.TextDocumentContentProvider {
50 public async provideTextDocumentContent(uri: vscode.Uri): Promise<string> {
51 console.assert(uri.path[0] === '/', "A preceding slash is expected on schema uri path");
52 const fileName: string = uri.path.substring(1);
53 const locale: string = getLocaleId();
54 let localizedFilePath: string = util.getExtensionFilePath(path.join("dist/schema/", locale, fileName));
55 const fileExists: boolean = await util.checkFileExists(localizedFilePath);
56 if (!fileExists) {
57 localizedFilePath = util.getExtensionFilePath(fileName);
58 }
59 return util.readFileText(localizedFilePath);
60 }
61 }
62
63 vscode.workspace.registerTextDocumentContentProvider('cpptools-schema', instrument(new SchemaProvider()));

Callers

nothing calls this directly

Calls 2

getLocaleIdFunction · 0.90
assertMethod · 0.80

Tested by

no test coverage detected