(uri: vscode.Uri)
| 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())); |
nothing calls this directly
no test coverage detected