aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-28 11:43:07 +0000
committerAleksey Kladov <[email protected]>2019-01-28 12:01:22 +0000
commitd1a67c1174abfb99b67b8db89c9f27c741e85057 (patch)
treeb589fcf2ee7d816f3f18bd83b8e88738dcb6fd4f /editors/code
parent7abe1f422c1a1230ad5b39474101806c438ef452 (diff)
align command naming
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/package.json50
-rw-r--r--editors/code/src/commands/analyzer_status.ts9
-rw-r--r--editors/code/src/commands/extend_selection.ts2
-rw-r--r--editors/code/src/commands/join_lines.ts2
-rw-r--r--editors/code/src/commands/matching_brace.ts2
-rw-r--r--editors/code/src/commands/on_enter.ts2
-rw-r--r--editors/code/src/commands/parent_module.ts2
-rw-r--r--editors/code/src/commands/runnables.ts2
-rw-r--r--editors/code/src/commands/syntaxTree.ts4
-rw-r--r--editors/code/src/config.ts2
-rw-r--r--editors/code/src/events/change_active_text_editor.ts2
-rw-r--r--editors/code/src/extension.ts40
-rw-r--r--editors/code/src/server.ts8
13 files changed, 72 insertions, 55 deletions
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 @@
72 ], 72 ],
73 "commands": [ 73 "commands": [
74 { 74 {
75 "command": "ra-lsp.syntaxTree", 75 "command": "rust-analyzer.syntaxTree",
76 "title": "Show Rust syntax tree" 76 "title": "rust-analyzer: syntax tree"
77 }, 77 },
78 { 78 {
79 "command": "ra-lsp.extendSelection", 79 "command": "rust-analyzer.extendSelection",
80 "title": "Rust Extend Selection" 80 "title": "rust-analyzer: extend selection"
81 }, 81 },
82 { 82 {
83 "command": "ra-lsp.matchingBrace", 83 "command": "rust-analyzer.matchingBrace",
84 "title": "Rust Matching Brace" 84 "title": "rust-analyzer: matching brace"
85 }, 85 },
86 { 86 {
87 "command": "ra-lsp.parentModule", 87 "command": "rust-analyzer.parentModule",
88 "title": "Rust Parent Module" 88 "title": "rust-analyzer: parent module"
89 }, 89 },
90 { 90 {
91 "command": "ra-lsp.joinLines", 91 "command": "rust-analyzer.joinLines",
92 "title": "Rust Join Lines" 92 "title": "rust-analyzer: join lines"
93 }, 93 },
94 { 94 {
95 "command": "ra-lsp.run", 95 "command": "rust-analyzer.run",
96 "title": "Rust Run" 96 "title": "rust-analyzer: run"
97 }, 97 },
98 { 98 {
99 "command": "ra-lsp.analyzerStatus", 99 "command": "rust-analyzer.analyzerStatus",
100 "title": "Status of rust-analyzer (debug)" 100 "title": "rust-analyzer: status"
101 }, 101 },
102 { 102 {
103 "command": "ra-lsp.collectGarbage", 103 "command": "rust-analyzer.collectGarbage",
104 "title": "Run rust-analyzer's GC" 104 "title": "rust-analyzer: run gc"
105 } 105 }
106 ], 106 ],
107 "keybindings": [ 107 "keybindings": [
108 { 108 {
109 "command": "ra-lsp.parentModule", 109 "command": "rust-analyzer.parentModule",
110 "key": "ctrl+u", 110 "key": "ctrl+u",
111 "when": "editorTextFocus && editorLangId == rust" 111 "when": "editorTextFocus && editorLangId == rust"
112 }, 112 },
113 { 113 {
114 "command": "ra-lsp.matchingBrace", 114 "command": "rust-analyzer.matchingBrace",
115 "key": "ctrl+shift+m", 115 "key": "ctrl+shift+m",
116 "when": "editorTextFocus && editorLangId == rust" 116 "when": "editorTextFocus && editorLangId == rust"
117 }, 117 },
118 { 118 {
119 "command": "ra-lsp.extendSelection", 119 "command": "rust-analyzer.extendSelection",
120 "key": "shift+alt+right", 120 "key": "shift+alt+right",
121 "when": "editorTextFocus && editorLangId == rust" 121 "when": "editorTextFocus && editorLangId == rust"
122 }, 122 },
123 { 123 {
124 "command": "ra-lsp.joinLines", 124 "command": "rust-analyzer.joinLines",
125 "key": "ctrl+shift+j", 125 "key": "ctrl+shift+j",
126 "when": "editorTextFocus && editorLangId == rust" 126 "when": "editorTextFocus && editorLangId == rust"
127 }, 127 },
128 { 128 {
129 "command": "ra-lsp.run", 129 "command": "rust-analyzer.run",
130 "key": "ctrl+r", 130 "key": "ctrl+r",
131 "when": "editorTextFocus && editorLangId == rust" 131 "when": "editorTextFocus && editorLangId == rust"
132 } 132 }
@@ -135,19 +135,19 @@
135 "type": "object", 135 "type": "object",
136 "title": "Rust Analyzer", 136 "title": "Rust Analyzer",
137 "properties": { 137 "properties": {
138 "ra-lsp.highlightingOn": { 138 "rust-analyzer.highlightingOn": {
139 "type": "boolean", 139 "type": "boolean",
140 "default": true, 140 "default": true,
141 "description": "Highlight Rust code (overrides built-in syntax highlighting)" 141 "description": "Highlight Rust code (overrides built-in syntax highlighting)"
142 }, 142 },
143 "ra-lsp.raLspServerPath": { 143 "rust-analyzer.raLspServerPath": {
144 "type": [ 144 "type": [
145 "string" 145 "string"
146 ], 146 ],
147 "default": "ra_lsp_server", 147 "default": "ra_lsp_server",
148 "description": "Path to ra_lsp_server executable" 148 "description": "Path to ra_lsp_server executable"
149 }, 149 },
150 "ra-lsp.trace.server": { 150 "rust-analyzer.trace.server": {
151 "type": "string", 151 "type": "string",
152 "scope": "window", 152 "scope": "window",
153 "enum": [ 153 "enum": [
@@ -156,7 +156,7 @@
156 "verbose" 156 "verbose"
157 ], 157 ],
158 "default": "off", 158 "default": "off",
159 "description": "Trace requests to the ra-lsp server" 159 "description": "Trace requests to the ra_lsp_server"
160 } 160 }
161 } 161 }
162 }, 162 },
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 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2import { Server } from '../server'; 2import { Server } from '../server';
3 3
4const statusUri = vscode.Uri.parse('ra-lsp-status://status'); 4const statusUri = vscode.Uri.parse('rust-analyzer-status://status');
5 5
6export class TextDocumentContentProvider 6export 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
4import { Server } from '../server'; 4import { Server } from '../server';
5 5
6export const syntaxTreeUri = vscode.Uri.parse('ra-lsp://syntaxtree'); 6export const syntaxTreeUri = vscode.Uri.parse('rust-analyzer://syntaxtree');
7 7
8export class TextDocumentContentProvider 8export 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 {