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 | 5x 1x 5x 5x 5x 5x 2x 2x 1x 1x 1x 2x 2x 2x | import * as vscode from 'vscode';
import { container } from 'tsyringe';
import { IToken } from '@faubulous/mentor-rdf-parsers';
import { ServiceToken } from '@src/services/tokens';
import { IDocumentFactory } from '@src/services/document/document-factory.interface';
import { IDocumentContextService } from '@src/services/document';
import { LanguageClientBase, SparqlDocument } from '@src/languages';
export class SparqlLanguageClient extends LanguageClientBase {
private get contextService() {
return container.resolve<IDocumentContextService>(ServiceToken.DocumentContextService);
}
private get documentFactory() {
return container.resolve<IDocumentFactory>(ServiceToken.DocumentFactory);
}
constructor() {
super('sparql', 'SPARQL');
}
override start(context: vscode.ExtensionContext): void {
super.start(context);
Eif (this.client) {
this.client.onNotification('mentor.message.updateContext', (params: { languageId: string, uri: string, tokens: IToken[] }) => {
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;
}
Eif (documentContext instanceof SparqlDocument) {
// Update the document context with the new tokens.
documentContext.setTokens(params.tokens);
// Resolve any pending token requests for this document.
// This allows loadDocument to proceed with triple loading.
this.contextService.resolveTokens(params.uri, params.tokens);
}
});
}
}
}
|