From d45bc4f47cf4b2e603dbe02d824312f408d89deb Mon Sep 17 00:00:00 2001 From: Dirk Baeumer Date: Mon, 4 Jun 2018 12:07:08 +0200 Subject: [PATCH] Cleanup lsp sample --- lsp-multi-root-sample/.vscode/launch.json | 2 +- lsp-multi-root-sample/server/src/server.ts | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lsp-multi-root-sample/.vscode/launch.json b/lsp-multi-root-sample/.vscode/launch.json index 813b8e5c..19d5e63d 100644 --- a/lsp-multi-root-sample/.vscode/launch.json +++ b/lsp-multi-root-sample/.vscode/launch.json @@ -5,7 +5,7 @@ { "type": "extensionHost", "request": "launch", - "name": "Launch Extension", + "name": "Launch Client", "runtimeExecutable": "${execPath}", "args": ["--extensionDevelopmentPath=${workspaceRoot}" ], "stopOnEntry": false, diff --git a/lsp-multi-root-sample/server/src/server.ts b/lsp-multi-root-sample/server/src/server.ts index 348fddfd..27091bcc 100644 --- a/lsp-multi-root-sample/server/src/server.ts +++ b/lsp-multi-root-sample/server/src/server.ts @@ -6,7 +6,8 @@ import { createConnection, TextDocuments, TextDocument, Diagnostic, DiagnosticSeverity, - ProposedFeatures, InitializeParams, DidChangeConfigurationNotification, CompletionItem, CompletionItemKind, TextDocumentPositionParams + ProposedFeatures, InitializeParams, DidChangeConfigurationNotification, CompletionItem, + CompletionItemKind, TextDocumentPositionParams } from 'vscode-languageserver'; // Create a connection for the server. The connection uses Node's IPC as a transport. @@ -51,32 +52,32 @@ connection.onInitialized(() => { }); // The example settings -interface Settings { +interface ExampleSettings { maxNumberOfProblems: number; } // The global settings, used when the `workspace/configuration` request is not supported by the client. // Please note that this is not the case when using this server with the client provided in this example // but could happen with other clients. -const defaultSettings: Settings = { maxNumberOfProblems: 1000 }; -let globalSettings: Settings = defaultSettings; +const defaultSettings: ExampleSettings = { maxNumberOfProblems: 1000 }; +let globalSettings: ExampleSettings = defaultSettings; // Cache the settings of all open documents -let documentSettings: Map> = new Map(); +let documentSettings: Map> = new Map(); connection.onDidChangeConfiguration(change => { if (hasConfigurationCapability) { // Reset all cached document settings documentSettings.clear(); } else { - globalSettings = (change.settings.lspMultiRootSample || defaultSettings); + globalSettings = (change.settings.lspMultiRootSample || defaultSettings); } // Revalidate all open text documents documents.all().forEach(validateTextDocument); }); -function getDocumentSettings(resource: string): Thenable { +function getDocumentSettings(resource: string): Thenable { if (!hasConfigurationCapability) { return Promise.resolve(globalSettings); }