import { getLanguageService } from 'vscode-html-languageservice'; import { createConnection, ProposedFeatures, TextDocuments, TextDocumentSyncKind } from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; let connection = createConnection(ProposedFeatures.all); let documents: TextDocuments = new TextDocuments(TextDocument); const htmlLanguageService = getLanguageService(); connection.onInitialize(() => { return { capabilities: { textDocumentSync: TextDocumentSyncKind.Full, completionProvider: { resolveProvider: false, }, }, }; }); connection.onCompletion(async (textDocumentPosition, token) => { console.log(token); const document = documents.get(textDocumentPosition.textDocument.uri); if (!document) { return null; } return htmlLanguageService.doComplete(document, textDocumentPosition.position, htmlLanguageService.parseHTMLDocument(document)); }); documents.listen(connection); connection.listen();