From a93456ce5029ffb1037f05020b1fe2437ba6fccd Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 21 May 2022 12:39:05 +0200 Subject: [PATCH 1/5] Add deprecation notification pop up --- src/extension.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/extension.ts b/src/extension.ts index 51b45081..3c941627 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,6 +32,17 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { + await window.showWarningMessage( + "rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons", + "Open in your browser", "Open in a new editor tab" + ).then(button => { + commands.executeCommand( + 'vscode.open', + button == "Open browser" + ? Uri.parse('https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer') + : Uri.parse("vscode:extension/rust-lang.rust-analyzer") + ); + }); context.subscriptions.push( ...[ configureLanguage(), From 3f544964502f40aa22b7456eebc1e793f6d741b8 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 21 May 2022 12:42:24 +0200 Subject: [PATCH 2/5] Add deprecation notice to README and title --- README.md | 4 +++- package.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 97cce3c7..e9d263bb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ -# Rust support for Visual Studio Code +# Rust support for Visual Studio Code (deprecated) [![](https://vsmarketplacebadge.apphb.com/version/rust-lang.rust.svg)](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust) [![VSCode + Node.js CI](https://img.shields.io/github/workflow/status/rust-lang/rls-vscode/VSCode%20+%20Node.js%20CI.svg?logo=github)](https://github.com/rust-lang/rls-vscode/actions?query=workflow%3A%22VSCode+%2B+Node.js+CI%22) +> Note: This extension has been deprecated in favor of the [rust-analyzer project](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer). + Adds language support for Rust to Visual Studio Code. Supports: * code completion diff --git a/package.json b/package.json index 206a9238..8e196b1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rust", - "displayName": "Rust", + "displayName": "Rust (deprecated)", "description": "Rust for Visual Studio Code (powered by Rust Language Server/Rust Analyzer). Provides lints, code completion and navigation, formatting and more.", "version": "0.7.8", "publisher": "rust-lang", From 3eafd7d7b2a43e7d5380699b15abb77a2dbeb2de Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 21 May 2022 12:50:21 +0200 Subject: [PATCH 3/5] Format --- src/extension.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 3c941627..0a7b78fc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,17 +32,22 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { - await window.showWarningMessage( - "rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons", - "Open in your browser", "Open in a new editor tab" - ).then(button => { - commands.executeCommand( - 'vscode.open', - button == "Open browser" - ? Uri.parse('https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer') - : Uri.parse("vscode:extension/rust-lang.rust-analyzer") - ); - }); + await window + .showWarningMessage( + 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', + 'Open in your browser', + 'Open in a new editor tab', + ) + .then(button => { + commands.executeCommand( + 'vscode.open', + button === 'Open browser' + ? Uri.parse( + 'https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer', + ) + : Uri.parse('vscode:extension/rust-lang.rust-analyzer'), + ); + }); context.subscriptions.push( ...[ configureLanguage(), From 95e89e7702294b099d2ff42aae3d3fdfb835bb77 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 25 May 2022 12:40:32 +0200 Subject: [PATCH 4/5] Add config to disable deprecation warning --- package.json | 5 +++++ src/extension.ts | 54 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 8e196b1c..8b8f096e 100644 --- a/package.json +++ b/package.json @@ -485,6 +485,11 @@ ], "default": null, "description": "When specified, uses the rust-analyzer binary at a given path" + }, + "rust-client.ignoreDeprecationWarning": { + "type": "boolean", + "default": false, + "description": "Whether to surpress the deprecation notification on start up." } } }, diff --git a/src/extension.ts b/src/extension.ts index 0a7b78fc..6a9bcecf 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,22 +32,43 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { - await window - .showWarningMessage( - 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', - 'Open in your browser', - 'Open in a new editor tab', - ) - .then(button => { - commands.executeCommand( - 'vscode.open', - button === 'Open browser' - ? Uri.parse( - 'https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer', - ) - : Uri.parse('vscode:extension/rust-lang.rust-analyzer'), - ); - }); + const config = workspace.getConfiguration(); + if (!config.get('rust-client.ignoreDeprecationWarning', false)) { + window + .showWarningMessage( + 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', + 'Open in your browser', + 'Open in a new editor tab', + 'Disable Warning', + ) + .then(button => { + switch (button) { + case 'Disable Warning': + config.update( + 'rust-client.ignoreDeprecationWarning', + true, + ConfigurationTarget.Global, + ); + break; + case 'Open in your browser': + commands.executeCommand( + 'vscode.open', + Uri.parse( + 'https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer', + ), + ); + break; + case 'Open in a new editor tab': + commands.executeCommand( + 'vscode.open', + Uri.parse('vscode:extension/rust-lang.rust-analyzer'), + ); + break; + default: + } + }); + } + context.subscriptions.push( ...[ configureLanguage(), @@ -62,7 +83,6 @@ export async function activate(context: ExtensionContext): Promise { // Migrate the users of multi-project setup for RLS to disable the setting // entirely (it's always on now) - const config = workspace.getConfiguration(); if ( typeof config.get( 'rust-client.enableMultiProjectSetup', From 0388a39ce61ae81536a689f35d1c007e12e51cee Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Wed, 25 May 2022 13:09:11 +0200 Subject: [PATCH 5/5] Update deprecation config key --- package.json | 2 +- src/extension.ts | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 8b8f096e..1f7e75ca 100644 --- a/package.json +++ b/package.json @@ -486,7 +486,7 @@ "default": null, "description": "When specified, uses the rust-analyzer binary at a given path" }, - "rust-client.ignoreDeprecationWarning": { + "rust.ignore_deprecation_warning": { "type": "boolean", "default": false, "description": "Whether to surpress the deprecation notification on start up." diff --git a/src/extension.ts b/src/extension.ts index 6a9bcecf..6225e05a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -32,8 +32,20 @@ export interface Api { } export async function activate(context: ExtensionContext): Promise { + context.subscriptions.push( + ...[ + configureLanguage(), + ...registerCommands(), + workspace.onDidChangeWorkspaceFolders(whenChangingWorkspaceFolders), + window.onDidChangeActiveTextEditor(onDidChangeActiveTextEditor), + ], + ); + // Manually trigger the first event to start up server instance if necessary, + // since VSCode doesn't do that on startup by itself. + onDidChangeActiveTextEditor(window.activeTextEditor); + const config = workspace.getConfiguration(); - if (!config.get('rust-client.ignoreDeprecationWarning', false)) { + if (!config.get('rust.ignore_deprecation_warning', false)) { window .showWarningMessage( 'rust-lang.rust has been deprecated. Please uninstall this extension and install rust-lang.rust-analyzer instead. You can find the extension by clicking on one of the buttons', @@ -45,7 +57,7 @@ export async function activate(context: ExtensionContext): Promise { switch (button) { case 'Disable Warning': config.update( - 'rust-client.ignoreDeprecationWarning', + 'rust.ignore_deprecation_warning', true, ConfigurationTarget.Global, ); @@ -69,18 +81,6 @@ export async function activate(context: ExtensionContext): Promise { }); } - context.subscriptions.push( - ...[ - configureLanguage(), - ...registerCommands(), - workspace.onDidChangeWorkspaceFolders(whenChangingWorkspaceFolders), - window.onDidChangeActiveTextEditor(onDidChangeActiveTextEditor), - ], - ); - // Manually trigger the first event to start up server instance if necessary, - // since VSCode doesn't do that on startup by itself. - onDidChangeActiveTextEditor(window.activeTextEditor); - // Migrate the users of multi-project setup for RLS to disable the setting // entirely (it's always on now) if (