How to use the vscode-languageclient.DidOpenTextDocumentNotification function in vscode-languageclient

To help you get started, we’ve selected a few vscode-languageclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DonJayamanne / pythonVSCode / src / client / datascience / interactive-window / intellisense / dotNetIntellisenseProvider.ts View on Github external
protected async handleChanges(originalFile: string | undefined, document: IntellisenseDocument, changes: TextDocumentContentChangeEvent[]): Promise {
        // Then see if we can talk to our language client
        if (this.active && document) {

            // Cache our document state as it may change after we get our language client. Async call may allow a change to
            // come in before we send the first doc open.
            const docItem = document.textDocumentItem;
            const docItemId = document.textDocumentId;

            // Broadcast an update to the language server
            const languageClient = await this.getLanguageClient(originalFile === Identifiers.EmptyFileName || originalFile === undefined ? undefined : Uri.file(originalFile));

            if (!this.sentOpenDocument) {
                this.sentOpenDocument = true;
                return languageClient.sendNotification(vscodeLanguageClient.DidOpenTextDocumentNotification.type, { textDocument: docItem });
            } else {
                return languageClient.sendNotification(vscodeLanguageClient.DidChangeTextDocumentNotification.type, { textDocument: docItemId, contentChanges: changes });
            }
        }
    }
github DonJayamanne / pythonVSCode / src / client / datascience / interactive-window / intellisense / dotNetIntellisenseProvider.ts View on Github external
protected async handleChanges(originalFile: string | undefined, document: IntellisenseDocument, changes: TextDocumentContentChangeEvent[]): Promise {
        // Then see if we can talk to our language client
        if (this.active && document) {

            // Cache our document state as it may change after we get our language client. Async call may allow a change to
            // come in before we send the first doc open.
            const docItem = document.textDocumentItem;
            const docItemId = document.textDocumentId;

            // Broadcast an update to the language server
            const languageClient = await this.getLanguageClient(originalFile === Identifiers.EmptyFileName || originalFile === undefined ? undefined : Uri.file(originalFile));

            if (!this.sentOpenDocument) {
                this.sentOpenDocument = true;
                return languageClient.sendNotification(vscodeLanguageClient.DidOpenTextDocumentNotification.type, { textDocument: docItem });
            } else {
                return languageClient.sendNotification(vscodeLanguageClient.DidChangeTextDocumentNotification.type, { textDocument: docItemId, contentChanges: changes });
            }
        }
    }
github DonJayamanne / pythonVSCode / src / client / datascience / interactive-common / intellisense / dotNetIntellisenseProvider.ts View on Github external
protected async handleChanges(originalFile: string | undefined, document: IntellisenseDocument, changes: TextDocumentContentChangeEvent[]): Promise {
        // Then see if we can talk to our language client
        if (this.active && document) {

            // Cache our document state as it may change after we get our language client. Async call may allow a change to
            // come in before we send the first doc open.
            const docItem = document.textDocumentItem;
            const docItemId = document.textDocumentId;

            // Broadcast an update to the language server
            const languageClient = await this.getLanguageClient(originalFile === Identifiers.EmptyFileName || originalFile === undefined ? undefined : Uri.file(originalFile));

            if (!this.sentOpenDocument) {
                this.sentOpenDocument = true;
                return languageClient.sendNotification(vscodeLanguageClient.DidOpenTextDocumentNotification.type, { textDocument: docItem });
            } else {
                return languageClient.sendNotification(vscodeLanguageClient.DidChangeTextDocumentNotification.type, { textDocument: docItemId, contentChanges: changes });
            }
        }
    }
github DonJayamanne / pythonVSCode / src / client / activation / languageServer / activator.ts View on Github external
public handleOpen(document: TextDocument): void {
        const languageClient = this.getLanguageClient();
        if (languageClient) {
            languageClient.sendNotification(vscodeLanguageClient.DidOpenTextDocumentNotification.type,
                languageClient.code2ProtocolConverter.asOpenTextDocumentParams(document));
        }
    }