diff options
Diffstat (limited to 'editors/code/src/commands/extend_selection.ts')
-rw-r--r-- | editors/code/src/commands/extend_selection.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/editors/code/src/commands/extend_selection.ts b/editors/code/src/commands/extend_selection.ts deleted file mode 100644 index 6f4187d15..000000000 --- a/editors/code/src/commands/extend_selection.ts +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | import * as vscode from 'vscode'; | ||
2 | |||
3 | import { Range, TextDocumentIdentifier } from 'vscode-languageclient'; | ||
4 | import { Server } from '../server'; | ||
5 | |||
6 | interface ExtendSelectionParams { | ||
7 | textDocument: TextDocumentIdentifier; | ||
8 | selections: Range[]; | ||
9 | } | ||
10 | |||
11 | interface ExtendSelectionResult { | ||
12 | selections: Range[]; | ||
13 | } | ||
14 | |||
15 | export async function handle() { | ||
16 | const editor = vscode.window.activeTextEditor; | ||
17 | if (editor == null || editor.document.languageId !== 'rust') { | ||
18 | return; | ||
19 | } | ||
20 | const request: ExtendSelectionParams = { | ||
21 | selections: editor.selections.map(s => | ||
22 | Server.client.code2ProtocolConverter.asRange(s) | ||
23 | ), | ||
24 | textDocument: { uri: editor.document.uri.toString() } | ||
25 | }; | ||
26 | const response = await Server.client.sendRequest<ExtendSelectionResult>( | ||
27 | 'rust-analyzer/extendSelection', | ||
28 | request | ||
29 | ); | ||
30 | editor.selections = response.selections.map((range: Range) => { | ||
31 | const r = Server.client.protocol2CodeConverter.asRange(range); | ||
32 | return new vscode.Selection(r.start, r.end); | ||
33 | }); | ||
34 | } | ||