diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 07:16:36 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 07:16:36 +0100 |
commit | c9798c0e6da53c132021f03ac7a50ccd8714b371 (patch) | |
tree | 0d6d49b2eb40ad161a72adbfbf9874b64540bf74 /editors/code/src/commands/apply_source_change.ts | |
parent | f4ad36e972989c3feed8671d6d6fca0aed37cd8f (diff) | |
parent | e26071d96e1ff56289213dbe78415f836de8a70e (diff) |
Merge #104
104: Add vscode extension to CI r=aochagavia a=DJMcNab
Note that this testing is only done on travis - we are only running formatting and linting, so feature parity on appveyor is not required.
CC @aochagavia.
Fixes? #100
Co-authored-by: Daniel McNab <[email protected]>
Diffstat (limited to 'editors/code/src/commands/apply_source_change.ts')
-rw-r--r-- | editors/code/src/commands/apply_source_change.ts | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/editors/code/src/commands/apply_source_change.ts b/editors/code/src/commands/apply_source_change.ts index 67765e5a3..cf921e3ac 100644 --- a/editors/code/src/commands/apply_source_change.ts +++ b/editors/code/src/commands/apply_source_change.ts | |||
@@ -20,8 +20,12 @@ export interface SourceChange { | |||
20 | export async function handle(change: SourceChange) { | 20 | export async function handle(change: SourceChange) { |
21 | const wsEdit = new vscode.WorkspaceEdit(); | 21 | const wsEdit = new vscode.WorkspaceEdit(); |
22 | for (const sourceEdit of change.sourceFileEdits) { | 22 | for (const sourceEdit of change.sourceFileEdits) { |
23 | const uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri); | 23 | const uri = Server.client.protocol2CodeConverter.asUri( |
24 | const edits = Server.client.protocol2CodeConverter.asTextEdits(sourceEdit.edits); | 24 | sourceEdit.textDocument.uri |
25 | ); | ||
26 | const edits = Server.client.protocol2CodeConverter.asTextEdits( | ||
27 | sourceEdit.edits | ||
28 | ); | ||
25 | wsEdit.set(uri, edits); | 29 | wsEdit.set(uri, edits); |
26 | } | 30 | } |
27 | let created; | 31 | let created; |
@@ -48,11 +52,19 @@ export async function handle(change: SourceChange) { | |||
48 | const doc = await vscode.workspace.openTextDocument(toOpen); | 52 | const doc = await vscode.workspace.openTextDocument(toOpen); |
49 | await vscode.window.showTextDocument(doc); | 53 | await vscode.window.showTextDocument(doc); |
50 | } else if (toReveal) { | 54 | } else if (toReveal) { |
51 | const uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri); | 55 | const uri = Server.client.protocol2CodeConverter.asUri( |
52 | const position = Server.client.protocol2CodeConverter.asPosition(toReveal.position); | 56 | toReveal.textDocument.uri |
57 | ); | ||
58 | const position = Server.client.protocol2CodeConverter.asPosition( | ||
59 | toReveal.position | ||
60 | ); | ||
53 | const editor = vscode.window.activeTextEditor; | 61 | const editor = vscode.window.activeTextEditor; |
54 | if (!editor || editor.document.uri.toString() !== uri.toString()) { return; } | 62 | if (!editor || editor.document.uri.toString() !== uri.toString()) { |
55 | if (!editor.selection.isEmpty) { return; } | 63 | return; |
64 | } | ||
65 | if (!editor.selection.isEmpty) { | ||
66 | return; | ||
67 | } | ||
56 | editor!.selection = new vscode.Selection(position, position); | 68 | editor!.selection = new vscode.Selection(position, position); |
57 | } | 69 | } |
58 | } | 70 | } |