From 0dcb1cb569417a17e27a4d8b34813ded41395268 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Wed, 6 Mar 2019 11:34:38 +0200 Subject: Add showWorkspaceLoadedNotification to vscode client This allows users to control whether or not they want to see the "workspace loaded" notification. This is done on the server side using InitializationOptions which are provided by the client. By default show_workspace_loaded is true, meaning the notification is sent. --- editors/code/package.json | 5 +++++ editors/code/src/config.ts | 7 +++++++ editors/code/src/server.ts | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/package.json b/editors/code/package.json index fda411810..47eaac878 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -150,6 +150,11 @@ "default": false, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, + "rust-analyzer.showWorkspaceLoadedNotification": { + "type": "boolean", + "default": true, + "description": "Show notification when workspace was loaded" + }, "rust-analyzer.enableEnhancedTyping": { "type": "boolean", "default": true, diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 4e353798c..afc5cc6af 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -8,6 +8,7 @@ export class Config { public highlightingOn = true; public enableEnhancedTyping = true; public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; + public showWorkspaceLoadedNotification = true; private prevEnhancedTyping: null | boolean = null; @@ -24,6 +25,12 @@ export class Config { this.highlightingOn = config.get('highlightingOn') as boolean; } + if (config.has('showWorkspaceLoadedNotification')) { + this.showWorkspaceLoadedNotification = config.get( + 'showWorkspaceLoadedNotification' + ) as boolean; + } + if (!this.highlightingOn && Server) { Server.highlighter.removeHighlights(); } diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 9ead87fae..50461b0c6 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts @@ -26,7 +26,9 @@ export class Server { const clientOptions: lc.LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'rust' }], initializationOptions: { - publishDecorations: true + publishDecorations: true, + showWorkspaceLoaded: + Server.config.showWorkspaceLoadedNotification }, traceOutputChannel }; -- cgit v1.2.3