aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-21 10:14:10 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-21 10:14:10 +0100
commit57608ecd9d202323dc610d52a80bd3bccbefc172 (patch)
tree8837e4192d6121115a5a9b94044d33bd683184b2 /editors/code/src/commands
parent31b7697cf6f4ebb4ebc35b055e6b4ad9a28e28e9 (diff)
parentfa12ed2b8f3466af88644e59127cd169549f8899 (diff)
Merge #1179
1179: switch to official extend selection API r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/extend_selection.ts34
-rw-r--r--editors/code/src/commands/index.ts2
2 files changed, 0 insertions, 36 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 @@
1import * as vscode from 'vscode';
2
3import { Range, TextDocumentIdentifier } from 'vscode-languageclient';
4import { Server } from '../server';
5
6interface ExtendSelectionParams {
7 textDocument: TextDocumentIdentifier;
8 selections: Range[];
9}
10
11interface ExtendSelectionResult {
12 selections: Range[];
13}
14
15export 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}
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index f36c4b040..194658497 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -1,6 +1,5 @@
1import * as analyzerStatus from './analyzer_status'; 1import * as analyzerStatus from './analyzer_status';
2import * as applySourceChange from './apply_source_change'; 2import * as applySourceChange from './apply_source_change';
3import * as extendSelection from './extend_selection';
4import * as joinLines from './join_lines'; 3import * as joinLines from './join_lines';
5import * as matchingBrace from './matching_brace'; 4import * as matchingBrace from './matching_brace';
6import * as onEnter from './on_enter'; 5import * as onEnter from './on_enter';
@@ -11,7 +10,6 @@ import * as syntaxTree from './syntaxTree';
11export { 10export {
12 analyzerStatus, 11 analyzerStatus,
13 applySourceChange, 12 applySourceChange,
14 extendSelection,
15 joinLines, 13 joinLines,
16 matchingBrace, 14 matchingBrace,
17 parentModule, 15 parentModule,