From d1a67c1174abfb99b67b8db89c9f27c741e85057 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 28 Jan 2019 14:43:07 +0300 Subject: align command naming --- editors/README.md | 2 +- editors/code/package.json | 50 +++++++++++----------- editors/code/src/commands/analyzer_status.ts | 9 ++-- editors/code/src/commands/extend_selection.ts | 2 +- editors/code/src/commands/join_lines.ts | 2 +- editors/code/src/commands/matching_brace.ts | 2 +- editors/code/src/commands/on_enter.ts | 2 +- editors/code/src/commands/parent_module.ts | 2 +- editors/code/src/commands/runnables.ts | 2 +- editors/code/src/commands/syntaxTree.ts | 4 +- editors/code/src/config.ts | 2 +- .../code/src/events/change_active_text_editor.ts | 2 +- editors/code/src/extension.ts | 40 ++++++++++------- editors/code/src/server.ts | 8 +++- 14 files changed, 73 insertions(+), 56 deletions(-) (limited to 'editors') diff --git a/editors/README.md b/editors/README.md index b35a1f367..2d6a3f21d 100644 --- a/editors/README.md +++ b/editors/README.md @@ -26,7 +26,7 @@ They are more experimental in nature and work only with VS Code. ### Syntax highlighting It overrides built-in highlighting, and works only with a specific theme -(zenburn). `ra-lsp.highlightingOn` setting can be used to disable it. +(zenburn). `rust-analyzer.highlightingOn` setting can be used to disable it. ### Go to symbol in workspace ctrl+t diff --git a/editors/code/package.json b/editors/code/package.json index 86683eb73..05c67d822 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -72,61 +72,61 @@ ], "commands": [ { - "command": "ra-lsp.syntaxTree", - "title": "Show Rust syntax tree" + "command": "rust-analyzer.syntaxTree", + "title": "rust-analyzer: syntax tree" }, { - "command": "ra-lsp.extendSelection", - "title": "Rust Extend Selection" + "command": "rust-analyzer.extendSelection", + "title": "rust-analyzer: extend selection" }, { - "command": "ra-lsp.matchingBrace", - "title": "Rust Matching Brace" + "command": "rust-analyzer.matchingBrace", + "title": "rust-analyzer: matching brace" }, { - "command": "ra-lsp.parentModule", - "title": "Rust Parent Module" + "command": "rust-analyzer.parentModule", + "title": "rust-analyzer: parent module" }, { - "command": "ra-lsp.joinLines", - "title": "Rust Join Lines" + "command": "rust-analyzer.joinLines", + "title": "rust-analyzer: join lines" }, { - "command": "ra-lsp.run", - "title": "Rust Run" + "command": "rust-analyzer.run", + "title": "rust-analyzer: run" }, { - "command": "ra-lsp.analyzerStatus", - "title": "Status of rust-analyzer (debug)" + "command": "rust-analyzer.analyzerStatus", + "title": "rust-analyzer: status" }, { - "command": "ra-lsp.collectGarbage", - "title": "Run rust-analyzer's GC" + "command": "rust-analyzer.collectGarbage", + "title": "rust-analyzer: run gc" } ], "keybindings": [ { - "command": "ra-lsp.parentModule", + "command": "rust-analyzer.parentModule", "key": "ctrl+u", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.matchingBrace", + "command": "rust-analyzer.matchingBrace", "key": "ctrl+shift+m", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.extendSelection", + "command": "rust-analyzer.extendSelection", "key": "shift+alt+right", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.joinLines", + "command": "rust-analyzer.joinLines", "key": "ctrl+shift+j", "when": "editorTextFocus && editorLangId == rust" }, { - "command": "ra-lsp.run", + "command": "rust-analyzer.run", "key": "ctrl+r", "when": "editorTextFocus && editorLangId == rust" } @@ -135,19 +135,19 @@ "type": "object", "title": "Rust Analyzer", "properties": { - "ra-lsp.highlightingOn": { + "rust-analyzer.highlightingOn": { "type": "boolean", "default": true, "description": "Highlight Rust code (overrides built-in syntax highlighting)" }, - "ra-lsp.raLspServerPath": { + "rust-analyzer.raLspServerPath": { "type": [ "string" ], "default": "ra_lsp_server", "description": "Path to ra_lsp_server executable" }, - "ra-lsp.trace.server": { + "rust-analyzer.trace.server": { "type": "string", "scope": "window", "enum": [ @@ -156,7 +156,7 @@ "verbose" ], "default": "off", - "description": "Trace requests to the ra-lsp server" + "description": "Trace requests to the ra_lsp_server" } } }, diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts index bb46a1990..63f82c92d 100644 --- a/editors/code/src/commands/analyzer_status.ts +++ b/editors/code/src/commands/analyzer_status.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import { Server } from '../server'; -const statusUri = vscode.Uri.parse('ra-lsp-status://status'); +const statusUri = vscode.Uri.parse('rust-analyzer-status://status'); export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { @@ -15,7 +15,10 @@ export class TextDocumentContentProvider if (editor == null) { return ''; } - return Server.client.sendRequest('ra/analyzerStatus', null); + return Server.client.sendRequest( + 'rust-analyzer/analyzerStatus', + null + ); } get onDidChange(): vscode.Event { @@ -31,7 +34,7 @@ export function makeCommand(context: vscode.ExtensionContext) { const textDocumentContentProvider = new TextDocumentContentProvider(); context.subscriptions.push( vscode.workspace.registerTextDocumentContentProvider( - 'ra-lsp-status', + 'rust-analyzer-status', textDocumentContentProvider ) ); diff --git a/editors/code/src/commands/extend_selection.ts b/editors/code/src/commands/extend_selection.ts index 7b96bbc37..6f4187d15 100644 --- a/editors/code/src/commands/extend_selection.ts +++ b/editors/code/src/commands/extend_selection.ts @@ -24,7 +24,7 @@ export async function handle() { textDocument: { uri: editor.document.uri.toString() } }; const response = await Server.client.sendRequest( - 'm/extendSelection', + 'rust-analyzer/extendSelection', request ); editor.selections = response.selections.map((range: Range) => { diff --git a/editors/code/src/commands/join_lines.ts b/editors/code/src/commands/join_lines.ts index 27d263b8a..0d4b12f4d 100644 --- a/editors/code/src/commands/join_lines.ts +++ b/editors/code/src/commands/join_lines.ts @@ -22,7 +22,7 @@ export async function handle() { textDocument: { uri: editor.document.uri.toString() } }; const change = await Server.client.sendRequest( - 'm/joinLines', + 'rust-analyzer/joinLines', request ); await applySourceChange(change); diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts index 5e6638e82..d86faf405 100644 --- a/editors/code/src/commands/matching_brace.ts +++ b/editors/code/src/commands/matching_brace.ts @@ -20,7 +20,7 @@ export async function handle() { }) }; const response = await Server.client.sendRequest( - 'm/findMatchingBrace', + 'rust-analyzer/findMatchingBrace', request ); editor.selections = editor.selections.map((sel, idx) => { diff --git a/editors/code/src/commands/on_enter.ts b/editors/code/src/commands/on_enter.ts index bb376e3cb..16dcb70c8 100644 --- a/editors/code/src/commands/on_enter.ts +++ b/editors/code/src/commands/on_enter.ts @@ -22,7 +22,7 @@ export async function handle(event: { text: string }): Promise { ) }; const change = await Server.client.sendRequest( - 'm/onEnter', + 'rust-analyzer/onEnter', request ); if (!change) { diff --git a/editors/code/src/commands/parent_module.ts b/editors/code/src/commands/parent_module.ts index 806c3d34c..9d30b7b59 100644 --- a/editors/code/src/commands/parent_module.ts +++ b/editors/code/src/commands/parent_module.ts @@ -15,7 +15,7 @@ export async function handle() { ) }; const response = await Server.client.sendRequest( - 'm/parentModule', + 'rust-analyzer/parentModule', request ); const loc = response[0]; diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index aa5817c21..d9ae56420 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts @@ -83,7 +83,7 @@ export async function handle() { ) }; const runnables = await Server.client.sendRequest( - 'm/runnables', + 'rust-analyzer/runnables', params ); const items: RunnableQuickPick[] = []; diff --git a/editors/code/src/commands/syntaxTree.ts b/editors/code/src/commands/syntaxTree.ts index 5d5cdd7a0..c0baf08c5 100644 --- a/editors/code/src/commands/syntaxTree.ts +++ b/editors/code/src/commands/syntaxTree.ts @@ -3,7 +3,7 @@ import { TextDocumentIdentifier } from 'vscode-languageclient'; import { Server } from '../server'; -export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); +export const syntaxTreeUri = vscode.Uri.parse('rust-analyzer://syntaxtree'); export class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { @@ -21,7 +21,7 @@ export class TextDocumentContentProvider textDocument: { uri: editor.document.uri.toString() } }; return Server.client.sendRequest( - 'm/syntaxTree', + 'rust-analyzer/syntaxTree', request ); } diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index cc7a10f76..d26f5df0a 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -16,7 +16,7 @@ export class Config { } public userConfigChanged() { - const config = vscode.workspace.getConfiguration('ra-lsp'); + const config = vscode.workspace.getConfiguration('rust-analyzer'); if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; } diff --git a/editors/code/src/events/change_active_text_editor.ts b/editors/code/src/events/change_active_text_editor.ts index 0b7ceb65d..af295b2ec 100644 --- a/editors/code/src/events/change_active_text_editor.ts +++ b/editors/code/src/events/change_active_text_editor.ts @@ -16,7 +16,7 @@ export async function handle(editor: TextEditor | undefined) { uri: editor.document.uri.toString() }; const decorations = await Server.client.sendRequest( - 'm/decorationsRequest', + 'rust-analyzer/decorationsRequest', params ); Server.highlighter.setHighlights(editor, decorations); diff --git a/editors/code/src/extension.ts b/editors/code/src/extension.ts index dc7b01403..0b2a6095b 100644 --- a/editors/code/src/extension.ts +++ b/editors/code/src/extension.ts @@ -46,31 +46,41 @@ export function activate(context: vscode.ExtensionContext) { // Commands are requests from vscode to the language server registerCommand( - 'ra-lsp.analyzerStatus', + 'rust-analyzer.analyzerStatus', commands.analyzerStatus.makeCommand(context) ); - registerCommand('ra-lsp.collectGarbage', () => - Server.client.sendRequest('ra/collectGarbage', null) + registerCommand('rust-analyzer.collectGarbage', () => + Server.client.sendRequest('rust-analyzer/collectGarbage', null) ); - registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); - registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); - registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); - registerCommand('ra-lsp.joinLines', commands.joinLines.handle); - registerCommand('ra-lsp.parentModule', commands.parentModule.handle); - registerCommand('ra-lsp.run', commands.runnables.handle); + registerCommand('rust-analyzer.syntaxTree', commands.syntaxTree.handle); registerCommand( - 'ra-lsp.applySourceChange', + 'rust-analyzer.extendSelection', + commands.extendSelection.handle + ); + registerCommand( + 'rust-analyzer.matchingBrace', + commands.matchingBrace.handle + ); + registerCommand('rust-analyzer.joinLines', commands.joinLines.handle); + registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); + registerCommand('rust-analyzer.run', commands.runnables.handle); + // Unlike the above this does not send requests to the language server + registerCommand('rust-analyzer.runSingle', commands.runnables.handleSingle); + registerCommand( + 'rust-analyzer.applySourceChange', commands.applySourceChange.handle ); overrideCommand('type', commands.onEnter.handle); - // Unlike the above this does not send requests to the language server - registerCommand('ra-lsp.run-single', commands.runnables.handleSingle); - // Notifications are events triggered by the language server const allNotifications: Iterable< [string, lc.GenericNotificationHandler] - > = [['m/publishDecorations', notifications.publishDecorations.handle]]; + > = [ + [ + 'rust-analyzer/publishDecorations', + notifications.publishDecorations.handle + ] + ]; // The events below are plain old javascript events, triggered and handled by vscode vscode.window.onDidChangeActiveTextEditor( @@ -80,7 +90,7 @@ export function activate(context: vscode.ExtensionContext) { const textDocumentContentProvider = new TextDocumentContentProvider(); disposeOnDeactivation( vscode.workspace.registerTextDocumentContentProvider( - 'ra-lsp', + 'rust-analyzer', textDocumentContentProvider ) ); diff --git a/editors/code/src/server.ts b/editors/code/src/server.ts index 35fb7e3f5..0d2632708 100644 --- a/editors/code/src/server.ts +++ b/editors/code/src/server.ts @@ -42,8 +42,12 @@ export class Server { log: (messageOrDataObject: string | any, data?: string) => { if (typeof messageOrDataObject === 'string') { if ( - messageOrDataObject.includes('m/publishDecorations') || - messageOrDataObject.includes('m/decorationsRequest') + messageOrDataObject.includes( + 'rust-analyzer/publishDecorations' + ) || + messageOrDataObject.includes( + 'rust-analyzer/decorationsRequest' + ) ) { // Don't log publish decorations requests } else { -- cgit v1.2.3