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..1f7e75ca 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", @@ -485,6 +485,11 @@ ], "default": null, "description": "When specified, uses the rust-analyzer binary at a given path" + }, + "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 51b45081..6225e05a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -44,9 +44,45 @@ export async function activate(context: ExtensionContext): Promise { // since VSCode doesn't do that on startup by itself. onDidChangeActiveTextEditor(window.activeTextEditor); + const config = workspace.getConfiguration(); + 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', + 'Open in your browser', + 'Open in a new editor tab', + 'Disable Warning', + ) + .then(button => { + switch (button) { + case 'Disable Warning': + config.update( + 'rust.ignore_deprecation_warning', + 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: + } + }); + } + // 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',