diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-28 12:01:56 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-28 12:01:56 +0000 |
commit | 3432c4366f578b4f0a9a6e0384292d72e43ebf03 (patch) | |
tree | b589fcf2ee7d816f3f18bd83b8e88738dcb6fd4f /editors/code/src | |
parent | 7abe1f422c1a1230ad5b39474101806c438ef452 (diff) | |
parent | d1a67c1174abfb99b67b8db89c9f27c741e85057 (diff) |
Merge #695
695: align command naming r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/commands/analyzer_status.ts | 9 | ||||
-rw-r--r-- | editors/code/src/commands/extend_selection.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/join_lines.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/matching_brace.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/on_enter.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/parent_module.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/runnables.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/syntaxTree.ts | 4 | ||||
-rw-r--r-- | editors/code/src/config.ts | 2 | ||||
-rw-r--r-- | editors/code/src/events/change_active_text_editor.ts | 2 | ||||
-rw-r--r-- | editors/code/src/extension.ts | 40 | ||||
-rw-r--r-- | editors/code/src/server.ts | 8 |
12 files changed, 47 insertions, 30 deletions
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 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import { Server } from '../server'; | 2 | import { Server } from '../server'; |
3 | 3 | ||
4 | const statusUri = vscode.Uri.parse('ra-lsp-status://status'); | 4 | const statusUri = vscode.Uri.parse('rust-analyzer-status://status'); |
5 | 5 | ||
6 | export class TextDocumentContentProvider | 6 | export class TextDocumentContentProvider |
7 | implements vscode.TextDocumentContentProvider { | 7 | implements vscode.TextDocumentContentProvider { |
@@ -15,7 +15,10 @@ export class TextDocumentContentProvider | |||
15 | if (editor == null) { | 15 | if (editor == null) { |
16 | return ''; | 16 | return ''; |
17 | } | 17 | } |
18 | return Server.client.sendRequest<string>('ra/analyzerStatus', null); | 18 | return Server.client.sendRequest<string>( |
19 | 'rust-analyzer/analyzerStatus', | ||
20 | null | ||
21 | ); | ||
19 | } | 22 | } |
20 | 23 | ||
21 | get onDidChange(): vscode.Event<vscode.Uri> { | 24 | get onDidChange(): vscode.Event<vscode.Uri> { |
@@ -31,7 +34,7 @@ export function makeCommand(context: vscode.ExtensionContext) { | |||
31 | const textDocumentContentProvider = new TextDocumentContentProvider(); | 34 | const textDocumentContentProvider = new TextDocumentContentProvider(); |
32 | context.subscriptions.push( | 35 | context.subscriptions.push( |
33 | vscode.workspace.registerTextDocumentContentProvider( | 36 | vscode.workspace.registerTextDocumentContentProvider( |
34 | 'ra-lsp-status', | 37 | 'rust-analyzer-status', |
35 | textDocumentContentProvider | 38 | textDocumentContentProvider |
36 | ) | 39 | ) |
37 | ); | 40 | ); |
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() { | |||
24 | textDocument: { uri: editor.document.uri.toString() } | 24 | textDocument: { uri: editor.document.uri.toString() } |
25 | }; | 25 | }; |
26 | const response = await Server.client.sendRequest<ExtendSelectionResult>( | 26 | const response = await Server.client.sendRequest<ExtendSelectionResult>( |
27 | 'm/extendSelection', | 27 | 'rust-analyzer/extendSelection', |
28 | request | 28 | request |
29 | ); | 29 | ); |
30 | editor.selections = response.selections.map((range: Range) => { | 30 | 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() { | |||
22 | textDocument: { uri: editor.document.uri.toString() } | 22 | textDocument: { uri: editor.document.uri.toString() } |
23 | }; | 23 | }; |
24 | const change = await Server.client.sendRequest<SourceChange>( | 24 | const change = await Server.client.sendRequest<SourceChange>( |
25 | 'm/joinLines', | 25 | 'rust-analyzer/joinLines', |
26 | request | 26 | request |
27 | ); | 27 | ); |
28 | await applySourceChange(change); | 28 | 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() { | |||
20 | }) | 20 | }) |
21 | }; | 21 | }; |
22 | const response = await Server.client.sendRequest<Position[]>( | 22 | const response = await Server.client.sendRequest<Position[]>( |
23 | 'm/findMatchingBrace', | 23 | 'rust-analyzer/findMatchingBrace', |
24 | request | 24 | request |
25 | ); | 25 | ); |
26 | editor.selections = editor.selections.map((sel, idx) => { | 26 | 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<boolean> { | |||
22 | ) | 22 | ) |
23 | }; | 23 | }; |
24 | const change = await Server.client.sendRequest<undefined | SourceChange>( | 24 | const change = await Server.client.sendRequest<undefined | SourceChange>( |
25 | 'm/onEnter', | 25 | 'rust-analyzer/onEnter', |
26 | request | 26 | request |
27 | ); | 27 | ); |
28 | if (!change) { | 28 | 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() { | |||
15 | ) | 15 | ) |
16 | }; | 16 | }; |
17 | const response = await Server.client.sendRequest<lc.Location[]>( | 17 | const response = await Server.client.sendRequest<lc.Location[]>( |
18 | 'm/parentModule', | 18 | 'rust-analyzer/parentModule', |
19 | request | 19 | request |
20 | ); | 20 | ); |
21 | const loc = response[0]; | 21 | 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() { | |||
83 | ) | 83 | ) |
84 | }; | 84 | }; |
85 | const runnables = await Server.client.sendRequest<Runnable[]>( | 85 | const runnables = await Server.client.sendRequest<Runnable[]>( |
86 | 'm/runnables', | 86 | 'rust-analyzer/runnables', |
87 | params | 87 | params |
88 | ); | 88 | ); |
89 | const items: RunnableQuickPick[] = []; | 89 | 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'; | |||
3 | 3 | ||
4 | import { Server } from '../server'; | 4 | import { Server } from '../server'; |
5 | 5 | ||
6 | export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); | 6 | export const syntaxTreeUri = vscode.Uri.parse('rust-analyzer://syntaxtree'); |
7 | 7 | ||
8 | export class TextDocumentContentProvider | 8 | export class TextDocumentContentProvider |
9 | implements vscode.TextDocumentContentProvider { | 9 | implements vscode.TextDocumentContentProvider { |
@@ -21,7 +21,7 @@ export class TextDocumentContentProvider | |||
21 | textDocument: { uri: editor.document.uri.toString() } | 21 | textDocument: { uri: editor.document.uri.toString() } |
22 | }; | 22 | }; |
23 | return Server.client.sendRequest<SyntaxTreeResult>( | 23 | return Server.client.sendRequest<SyntaxTreeResult>( |
24 | 'm/syntaxTree', | 24 | 'rust-analyzer/syntaxTree', |
25 | request | 25 | request |
26 | ); | 26 | ); |
27 | } | 27 | } |
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 { | |||
16 | } | 16 | } |
17 | 17 | ||
18 | public userConfigChanged() { | 18 | public userConfigChanged() { |
19 | const config = vscode.workspace.getConfiguration('ra-lsp'); | 19 | const config = vscode.workspace.getConfiguration('rust-analyzer'); |
20 | if (config.has('highlightingOn')) { | 20 | if (config.has('highlightingOn')) { |
21 | this.highlightingOn = config.get('highlightingOn') as boolean; | 21 | this.highlightingOn = config.get('highlightingOn') as boolean; |
22 | } | 22 | } |
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) { | |||
16 | uri: editor.document.uri.toString() | 16 | uri: editor.document.uri.toString() |
17 | }; | 17 | }; |
18 | const decorations = await Server.client.sendRequest<Decoration[]>( | 18 | const decorations = await Server.client.sendRequest<Decoration[]>( |
19 | 'm/decorationsRequest', | 19 | 'rust-analyzer/decorationsRequest', |
20 | params | 20 | params |
21 | ); | 21 | ); |
22 | Server.highlighter.setHighlights(editor, decorations); | 22 | 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) { | |||
46 | 46 | ||
47 | // Commands are requests from vscode to the language server | 47 | // Commands are requests from vscode to the language server |
48 | registerCommand( | 48 | registerCommand( |
49 | 'ra-lsp.analyzerStatus', | 49 | 'rust-analyzer.analyzerStatus', |
50 | commands.analyzerStatus.makeCommand(context) | 50 | commands.analyzerStatus.makeCommand(context) |
51 | ); | 51 | ); |
52 | registerCommand('ra-lsp.collectGarbage', () => | 52 | registerCommand('rust-analyzer.collectGarbage', () => |
53 | Server.client.sendRequest<null>('ra/collectGarbage', null) | 53 | Server.client.sendRequest<null>('rust-analyzer/collectGarbage', null) |
54 | ); | 54 | ); |
55 | registerCommand('ra-lsp.syntaxTree', commands.syntaxTree.handle); | 55 | registerCommand('rust-analyzer.syntaxTree', commands.syntaxTree.handle); |
56 | registerCommand('ra-lsp.extendSelection', commands.extendSelection.handle); | ||
57 | registerCommand('ra-lsp.matchingBrace', commands.matchingBrace.handle); | ||
58 | registerCommand('ra-lsp.joinLines', commands.joinLines.handle); | ||
59 | registerCommand('ra-lsp.parentModule', commands.parentModule.handle); | ||
60 | registerCommand('ra-lsp.run', commands.runnables.handle); | ||
61 | registerCommand( | 56 | registerCommand( |
62 | 'ra-lsp.applySourceChange', | 57 | 'rust-analyzer.extendSelection', |
58 | commands.extendSelection.handle | ||
59 | ); | ||
60 | registerCommand( | ||
61 | 'rust-analyzer.matchingBrace', | ||
62 | commands.matchingBrace.handle | ||
63 | ); | ||
64 | registerCommand('rust-analyzer.joinLines', commands.joinLines.handle); | ||
65 | registerCommand('rust-analyzer.parentModule', commands.parentModule.handle); | ||
66 | registerCommand('rust-analyzer.run', commands.runnables.handle); | ||
67 | // Unlike the above this does not send requests to the language server | ||
68 | registerCommand('rust-analyzer.runSingle', commands.runnables.handleSingle); | ||
69 | registerCommand( | ||
70 | 'rust-analyzer.applySourceChange', | ||
63 | commands.applySourceChange.handle | 71 | commands.applySourceChange.handle |
64 | ); | 72 | ); |
65 | overrideCommand('type', commands.onEnter.handle); | 73 | overrideCommand('type', commands.onEnter.handle); |
66 | 74 | ||
67 | // Unlike the above this does not send requests to the language server | ||
68 | registerCommand('ra-lsp.run-single', commands.runnables.handleSingle); | ||
69 | |||
70 | // Notifications are events triggered by the language server | 75 | // Notifications are events triggered by the language server |
71 | const allNotifications: Iterable< | 76 | const allNotifications: Iterable< |
72 | [string, lc.GenericNotificationHandler] | 77 | [string, lc.GenericNotificationHandler] |
73 | > = [['m/publishDecorations', notifications.publishDecorations.handle]]; | 78 | > = [ |
79 | [ | ||
80 | 'rust-analyzer/publishDecorations', | ||
81 | notifications.publishDecorations.handle | ||
82 | ] | ||
83 | ]; | ||
74 | 84 | ||
75 | // The events below are plain old javascript events, triggered and handled by vscode | 85 | // The events below are plain old javascript events, triggered and handled by vscode |
76 | vscode.window.onDidChangeActiveTextEditor( | 86 | vscode.window.onDidChangeActiveTextEditor( |
@@ -80,7 +90,7 @@ export function activate(context: vscode.ExtensionContext) { | |||
80 | const textDocumentContentProvider = new TextDocumentContentProvider(); | 90 | const textDocumentContentProvider = new TextDocumentContentProvider(); |
81 | disposeOnDeactivation( | 91 | disposeOnDeactivation( |
82 | vscode.workspace.registerTextDocumentContentProvider( | 92 | vscode.workspace.registerTextDocumentContentProvider( |
83 | 'ra-lsp', | 93 | 'rust-analyzer', |
84 | textDocumentContentProvider | 94 | textDocumentContentProvider |
85 | ) | 95 | ) |
86 | ); | 96 | ); |
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 { | |||
42 | log: (messageOrDataObject: string | any, data?: string) => { | 42 | log: (messageOrDataObject: string | any, data?: string) => { |
43 | if (typeof messageOrDataObject === 'string') { | 43 | if (typeof messageOrDataObject === 'string') { |
44 | if ( | 44 | if ( |
45 | messageOrDataObject.includes('m/publishDecorations') || | 45 | messageOrDataObject.includes( |
46 | messageOrDataObject.includes('m/decorationsRequest') | 46 | 'rust-analyzer/publishDecorations' |
47 | ) || | ||
48 | messageOrDataObject.includes( | ||
49 | 'rust-analyzer/decorationsRequest' | ||
50 | ) | ||
47 | ) { | 51 | ) { |
48 | // Don't log publish decorations requests | 52 | // Don't log publish decorations requests |
49 | } else { | 53 | } else { |