diff --git a/lsp-multi-root-sample/client/package-lock.json b/lsp-multi-root-sample/client/package-lock.json index 4db7f452..75f0f807 100644 --- a/lsp-multi-root-sample/client/package-lock.json +++ b/lsp-multi-root-sample/client/package-lock.json @@ -2093,33 +2093,35 @@ "vinyl-source-stream": "1.1.2" } }, - "vscode-jsonrpc": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.5.0.tgz", - "integrity": "sha1-hyOdnhZrLXNSJFuKgTWXgEwdY6o=" - }, "vscode-languageclient": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-3.5.0.tgz", - "integrity": "sha1-NtAswYaoNlpEZ3GaKQ+yAKmuSQo=", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-4.1.3.tgz", + "integrity": "sha512-3tu79B56apocobPGkHm7YWobjhNKCU7H4cUk+rkVFCNoOSAm2wZlN2J6HdC15/ONALY4ai25BeyQ+aQaFmM1Jg==", "requires": { - "vscode-languageserver-protocol": "3.5.0" + "vscode-languageserver-protocol": "3.7.1" + }, + "dependencies": { + "vscode-jsonrpc": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.6.1.tgz", + "integrity": "sha512-+Eb+Dxf2kC2h079msx61hkblxAKE0S2j78+8QpnigLAO2aIIjkCwTIH34etBrU8E8VItRinec7YEwULx9at5bQ==" + }, + "vscode-languageserver-protocol": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.1.tgz", + "integrity": "sha512-AKX9XQ49m/lpiDLZJBypFNc5eAXNlSecunYU5m4o5WIwGgW86TWnXVdziuFm47W2SdigDa/jVbxLPSNUeut9fQ==", + "requires": { + "vscode-jsonrpc": "3.6.1", + "vscode-languageserver-types": "3.7.1" + } + }, + "vscode-languageserver-types": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.7.1.tgz", + "integrity": "sha512-ftGfU79AnnI3OHCG7kzCCN47jNI7BjECPAH2yhddtYTiQk0bnFbuFeQKvpXQcyNI3GsKEx5b6kSiBYshTiep6w==" + } } }, - "vscode-languageserver-protocol": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.5.0.tgz", - "integrity": "sha1-Bnxcvidwl5U5jRGWksl+u6FFIgk=", - "requires": { - "vscode-jsonrpc": "3.5.0", - "vscode-languageserver-types": "3.5.0" - } - }, - "vscode-languageserver-types": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.5.0.tgz", - "integrity": "sha1-5I15li8LjgLelV4/UkkI4rGcA3Q=" - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/lsp-multi-root-sample/client/package.json b/lsp-multi-root-sample/client/package.json index e6787441..e48f46ad 100644 --- a/lsp-multi-root-sample/client/package.json +++ b/lsp-multi-root-sample/client/package.json @@ -10,7 +10,7 @@ "url": "https://github.com/Microsoft/vscode-extension-samples" }, "engines": { - "vscode": "^1.16.0" + "vscode": "^1.23.0" }, "categories": [ "Other" @@ -53,6 +53,6 @@ }, "dependencies": { "vscode": "^1.1.17", - "vscode-languageclient": "^3.5.0" + "vscode-languageclient": "^4.1.3" } } diff --git a/lsp-multi-root-sample/client/src/extension.ts b/lsp-multi-root-sample/client/src/extension.ts index 19f5370b..7495971f 100644 --- a/lsp-multi-root-sample/client/src/extension.ts +++ b/lsp-multi-root-sample/client/src/extension.ts @@ -7,9 +7,9 @@ import * as path from 'path'; import { workspace, ExtensionContext, WorkspaceConfiguration, Disposable } from 'vscode'; -import { - LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, CancellationToken, Middleware, - DidChangeConfigurationNotification, Proposed, ProposedFeatures +import { + LanguageClient, LanguageClientOptions, ServerOptions, TransportKind, CancellationToken, Middleware, + DidChangeConfigurationNotification, ConfigurationParams } from 'vscode-languageclient'; // The example settings @@ -24,8 +24,8 @@ namespace Configuration { let configurationListener: Disposable; // Convert VS Code specific settings to a format acceptable by the server. Since - // both client and server do use JSON the conversion is trivial. - export function computeConfiguration(params: Proposed.ConfigurationParams, _token: CancellationToken, _next: Function): any[] { + // both client and server do use JSON the conversion is trivial. + export function computeConfiguration(params: ConfigurationParams, _token: CancellationToken, _next: Function): any[] { if (!params.items) { return null; } @@ -50,9 +50,9 @@ namespace Configuration { } return result; } - + export function initialize() { - // VS Code currently doesn't sent fine grained configuration changes. So we + // VS Code currently doesn't sent fine grained configuration changes. So we // listen to any change. However this will change in the near future. configurationListener = workspace.onDidChangeConfiguration(() => { client.sendNotification(DidChangeConfigurationNotification.type, { settings: null }); @@ -73,7 +73,7 @@ export function activate(context: ExtensionContext) { let serverModule = context.asAbsolutePath(path.join('server', 'server.js')); // The debug options for the server let debugOptions = { execArgv: ["--nolazy", "--inspect=6009"] }; - + // If the extension is launched in debug mode then the debug server options are used // Otherwise the run options are used let serverOptions: ServerOptions = { @@ -81,7 +81,7 @@ export function activate(context: ExtensionContext) { debug: { module: serverModule, transport: TransportKind.ipc, options: debugOptions } } - let middleware: ProposedFeatures.ConfigurationMiddleware | Middleware = { + let middleware: Middleware = { workspace: { configuration: Configuration.computeConfiguration } @@ -96,20 +96,15 @@ export function activate(context: ExtensionContext) { fileEvents: workspace.createFileSystemWatcher('**/.clientrc'), // In the past this told the client to actively synchronize settings. Since the // client now supports 'getConfiguration' requests this active synchronization is not - // necessary anymore. + // necessary anymore. // configurationSection: [ 'lspMultiRootSample' ] }, - middleware: middleware as Middleware + middleware: middleware } - + // Create the language client and start the client. client = new LanguageClient('languageServerExample', 'Language Server Example', serverOptions, clientOptions); - // Register new proposed protocol if available. - client.registerProposedFeatures(); - client.onReady().then(() => { - Configuration.initialize(); - }); - + // Start the client. This will also launch the server client.start(); } diff --git a/lsp-multi-root-sample/server/package-lock.json b/lsp-multi-root-sample/server/package-lock.json index d0fc5df7..52ff059a 100644 --- a/lsp-multi-root-sample/server/package-lock.json +++ b/lsp-multi-root-sample/server/package-lock.json @@ -4,34 +4,36 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "vscode-jsonrpc": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.5.0.tgz", - "integrity": "sha1-hyOdnhZrLXNSJFuKgTWXgEwdY6o=" - }, "vscode-languageserver": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.5.0.tgz", - "integrity": "sha1-0oCZvG3dqMHdFrcH5FThsd2uDbo=", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-4.1.2.tgz", + "integrity": "sha512-3iej2tuMaI9yirPXF7/fVyIvBhSzbwZ3EWFRb8bP6lc3tGv9SJHDaJLNyQMgo9J8CNpXil6dWarpJvGSA60v/w==", "requires": { - "vscode-languageserver-protocol": "3.5.0", + "vscode-languageserver-protocol": "3.7.1", "vscode-uri": "1.0.1" + }, + "dependencies": { + "vscode-jsonrpc": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.6.1.tgz", + "integrity": "sha512-+Eb+Dxf2kC2h079msx61hkblxAKE0S2j78+8QpnigLAO2aIIjkCwTIH34etBrU8E8VItRinec7YEwULx9at5bQ==" + }, + "vscode-languageserver-protocol": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.7.1.tgz", + "integrity": "sha512-AKX9XQ49m/lpiDLZJBypFNc5eAXNlSecunYU5m4o5WIwGgW86TWnXVdziuFm47W2SdigDa/jVbxLPSNUeut9fQ==", + "requires": { + "vscode-jsonrpc": "3.6.1", + "vscode-languageserver-types": "3.7.1" + } + }, + "vscode-languageserver-types": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.7.1.tgz", + "integrity": "sha512-ftGfU79AnnI3OHCG7kzCCN47jNI7BjECPAH2yhddtYTiQk0bnFbuFeQKvpXQcyNI3GsKEx5b6kSiBYshTiep6w==" + } } }, - "vscode-languageserver-protocol": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.5.0.tgz", - "integrity": "sha1-Bnxcvidwl5U5jRGWksl+u6FFIgk=", - "requires": { - "vscode-jsonrpc": "3.5.0", - "vscode-languageserver-types": "3.5.0" - } - }, - "vscode-languageserver-types": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.5.0.tgz", - "integrity": "sha1-5I15li8LjgLelV4/UkkI4rGcA3Q=" - }, "vscode-uri": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-1.0.1.tgz", diff --git a/lsp-multi-root-sample/server/package.json b/lsp-multi-root-sample/server/package.json index 563867a4..462f9a83 100644 --- a/lsp-multi-root-sample/server/package.json +++ b/lsp-multi-root-sample/server/package.json @@ -12,7 +12,7 @@ "url": "https://github.com/Microsoft/vscode-extension-samples" }, "dependencies": { - "vscode-languageserver": "^3.5.0" + "vscode-languageserver": "^4.1.2" }, "scripts": { "installServer": "installServerIntoExtension ../client ./package.json ./tsconfig.json", diff --git a/lsp-multi-root-sample/server/src/server.ts b/lsp-multi-root-sample/server/src/server.ts index 62931c13..822f1a18 100644 --- a/lsp-multi-root-sample/server/src/server.ts +++ b/lsp-multi-root-sample/server/src/server.ts @@ -6,7 +6,7 @@ import { createConnection, TextDocuments, TextDocument, Diagnostic, DiagnosticSeverity, - ProposedFeatures, InitializeParams, Proposed + ProposedFeatures, InitializeParams, DidChangeConfigurationNotification } from 'vscode-languageserver'; // Create a connection for the server. The connection uses Node's IPC as a transport. @@ -25,8 +25,8 @@ connection.onInitialize((params: InitializeParams) => { // Does the client support the `workspace/configuration` request? // If not, we will fall back using global settings - hasWorkspaceFolderCapability = (capabilities as Proposed.WorkspaceFoldersClientCapabilities).workspace && !!(capabilities as Proposed.WorkspaceFoldersClientCapabilities).workspace.workspaceFolders; - hasConfigurationCapability = (capabilities as Proposed.ConfigurationClientCapabilities).workspace && !!(capabilities as Proposed.ConfigurationClientCapabilities).workspace.configuration; + hasConfigurationCapability = capabilities.workspace && !!capabilities.workspace.configuration; + hasWorkspaceFolderCapability = capabilities.workspace && !!capabilities.workspace.workspaceFolders; return { capabilities: { @@ -36,9 +36,12 @@ connection.onInitialize((params: InitializeParams) => { }); connection.onInitialized(() => { + if (hasConfigurationCapability) { + connection.client.register(DidChangeConfigurationNotification.type, undefined); + } if (hasWorkspaceFolderCapability) { connection.workspace.onDidChangeWorkspaceFolders((_event) => { - connection.console.log('Workspace folder change event received'); + connection.console.log('Workspace folder change event received.'); }); } });