mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
Update LSP Sample
This commit is contained in:
@ -6,7 +6,6 @@
|
||||
import {
|
||||
createConnection,
|
||||
TextDocuments,
|
||||
TextDocument,
|
||||
Diagnostic,
|
||||
DiagnosticSeverity,
|
||||
ProposedFeatures,
|
||||
@ -14,16 +13,22 @@ import {
|
||||
DidChangeConfigurationNotification,
|
||||
CompletionItem,
|
||||
CompletionItemKind,
|
||||
TextDocumentPositionParams
|
||||
TextDocumentPositionParams,
|
||||
TextDocumentSyncKind,
|
||||
InitializeResult
|
||||
} from 'vscode-languageserver';
|
||||
|
||||
import {
|
||||
TextDocument
|
||||
} from 'vscode-languageserver-textdocument';
|
||||
|
||||
// Create a connection for the server. The connection uses Node's IPC as a transport.
|
||||
// Also include all preview / proposed LSP features.
|
||||
let connection = createConnection(ProposedFeatures.all);
|
||||
|
||||
// Create a simple text document manager. The text document manager
|
||||
// supports full document sync only
|
||||
let documents: TextDocuments = new TextDocuments();
|
||||
let documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);
|
||||
|
||||
let hasConfigurationCapability: boolean = false;
|
||||
let hasWorkspaceFolderCapability: boolean = false;
|
||||
@ -46,15 +51,23 @@ connection.onInitialize((params: InitializeParams) => {
|
||||
capabilities.textDocument.publishDiagnostics.relatedInformation
|
||||
);
|
||||
|
||||
return {
|
||||
const result: InitializeResult = {
|
||||
capabilities: {
|
||||
textDocumentSync: documents.syncKind,
|
||||
textDocumentSync: TextDocumentSyncKind.Full,
|
||||
// Tell the client that the server supports code completion
|
||||
completionProvider: {
|
||||
resolveProvider: true
|
||||
}
|
||||
}
|
||||
};
|
||||
if (hasWorkspaceFolderCapability) {
|
||||
result.capabilities.workspace = {
|
||||
workspaceFolders: {
|
||||
supported: true
|
||||
}
|
||||
};
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
connection.onInitialized(() => {
|
||||
|
||||
Reference in New Issue
Block a user