Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 6x 1x 6x 6x 6x 6x 3x 3x 1x 1x 1x 3x 2x 2x | import * as vscode from 'vscode';
import { container } from 'tsyringe';
import { ServiceToken } from '@src/services/tokens';
import { IDocumentContextService } from '@src/services/document';
import { LanguageClientBase, XmlDocument } from '@src/languages';
import { XmlParseResult } from '@src/languages/xml/xml-types';
import { IDocumentFactory } from '@src/services/document/document-factory.interface';
export class XmlLanguageClient extends LanguageClientBase {
private get contextService() {
return container.resolve<IDocumentContextService>(ServiceToken.DocumentContextService);
}
private get documentFactory() {
return container.resolve<IDocumentFactory>(ServiceToken.DocumentFactory);
}
constructor() {
super('xml', 'RDF/XML');
}
override start(context: vscode.ExtensionContext): void {
super.start(context);
Eif (this.client) {
this.client.onNotification('mentor.message.updateContext', (params: { languageId: string, uri: string, parsedData: XmlParseResult }) => {
let documentContext = this.contextService.contexts[params.uri];
if (documentContext === undefined) {
const uri = vscode.Uri.parse(params.uri);
documentContext = this.documentFactory.create(uri, this.languageId);
this.contextService.contexts[params.uri] = documentContext;
}
if (documentContext instanceof XmlDocument) {
// Update the document context with the parsed data from the language server.
documentContext.setParsedData(params.parsedData);
// Resolve any pending token requests for this document.
// This allows loadDocument to proceed with triple loading.
// We pass an empty array since XML doesn't use tokens.
this.contextService.resolveTokens(params.uri, []);
}
});
}
}
}
|