diff options
author | Adolfo OchagavĂa <[email protected]> | 2018-10-08 19:18:55 +0100 |
---|---|---|
committer | Adolfo OchagavĂa <[email protected]> | 2018-10-08 19:18:55 +0100 |
commit | 62b1b05a0d9dd021f98352b6229e48e0d8b94f78 (patch) | |
tree | 92627c1590c7f38b29a6d0d86f1db3d5b7332ad0 /editors/code/src/commands | |
parent | 4d62cfccbb8281f33b6f894df07e7316a9d45bfb (diff) |
Fix remaining tslint suggestions
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r-- | editors/code/src/commands/apply_source_change.ts | 26 | ||||
-rw-r--r-- | editors/code/src/commands/extend_selection.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/index.ts | 17 | ||||
-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/parent_module.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/runnables.ts | 4 |
7 files changed, 36 insertions, 19 deletions
diff --git a/editors/code/src/commands/apply_source_change.ts b/editors/code/src/commands/apply_source_change.ts index f011cbe12..67765e5a3 100644 --- a/editors/code/src/commands/apply_source_change.ts +++ b/editors/code/src/commands/apply_source_change.ts | |||
@@ -18,7 +18,6 @@ export interface SourceChange { | |||
18 | } | 18 | } |
19 | 19 | ||
20 | export async function handle(change: SourceChange) { | 20 | export async function handle(change: SourceChange) { |
21 | console.log(`applySOurceChange ${JSON.stringify(change)}`); | ||
22 | const wsEdit = new vscode.WorkspaceEdit(); | 21 | const wsEdit = new vscode.WorkspaceEdit(); |
23 | for (const sourceEdit of change.sourceFileEdits) { | 22 | for (const sourceEdit of change.sourceFileEdits) { |
24 | const uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri); | 23 | const uri = Server.client.protocol2CodeConverter.asUri(sourceEdit.textDocument.uri); |
@@ -28,17 +27,18 @@ export async function handle(change: SourceChange) { | |||
28 | let created; | 27 | let created; |
29 | let moved; | 28 | let moved; |
30 | for (const fsEdit of change.fileSystemEdits) { | 29 | for (const fsEdit of change.fileSystemEdits) { |
31 | if (fsEdit.type == 'createFile') { | 30 | switch (fsEdit.type) { |
32 | const uri = vscode.Uri.parse(fsEdit.uri!); | 31 | case 'createFile': |
33 | wsEdit.createFile(uri); | 32 | const uri = vscode.Uri.parse(fsEdit.uri!); |
34 | created = uri; | 33 | wsEdit.createFile(uri); |
35 | } else if (fsEdit.type == 'moveFile') { | 34 | created = uri; |
36 | const src = vscode.Uri.parse(fsEdit.src!); | 35 | break; |
37 | const dst = vscode.Uri.parse(fsEdit.dst!); | 36 | case 'moveFile': |
38 | wsEdit.renameFile(src, dst); | 37 | const src = vscode.Uri.parse(fsEdit.src!); |
39 | moved = dst; | 38 | const dst = vscode.Uri.parse(fsEdit.dst!); |
40 | } else { | 39 | wsEdit.renameFile(src, dst); |
41 | console.error(`unknown op: ${JSON.stringify(fsEdit)}`); | 40 | moved = dst; |
41 | break; | ||
42 | } | 42 | } |
43 | } | 43 | } |
44 | const toOpen = created || moved; | 44 | const toOpen = created || moved; |
@@ -51,7 +51,7 @@ export async function handle(change: SourceChange) { | |||
51 | const uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri); | 51 | const uri = Server.client.protocol2CodeConverter.asUri(toReveal.textDocument.uri); |
52 | const position = Server.client.protocol2CodeConverter.asPosition(toReveal.position); | 52 | const position = Server.client.protocol2CodeConverter.asPosition(toReveal.position); |
53 | const editor = vscode.window.activeTextEditor; | 53 | const editor = vscode.window.activeTextEditor; |
54 | if (!editor || editor.document.uri.toString() != uri.toString()) { return; } | 54 | if (!editor || editor.document.uri.toString() !== uri.toString()) { return; } |
55 | if (!editor.selection.isEmpty) { return; } | 55 | if (!editor.selection.isEmpty) { return; } |
56 | editor!.selection = new vscode.Selection(position, position); | 56 | editor!.selection = new vscode.Selection(position, position); |
57 | } | 57 | } |
diff --git a/editors/code/src/commands/extend_selection.ts b/editors/code/src/commands/extend_selection.ts index b722ac172..cdc3d10fb 100644 --- a/editors/code/src/commands/extend_selection.ts +++ b/editors/code/src/commands/extend_selection.ts | |||
@@ -14,7 +14,7 @@ interface ExtendSelectionResult { | |||
14 | 14 | ||
15 | export async function handle() { | 15 | export async function handle() { |
16 | const editor = vscode.window.activeTextEditor; | 16 | const editor = vscode.window.activeTextEditor; |
17 | if (editor == null || editor.document.languageId != 'rust') { return; } | 17 | if (editor == null || editor.document.languageId !== 'rust') { return; } |
18 | const request: ExtendSelectionParams = { | 18 | const request: ExtendSelectionParams = { |
19 | selections: editor.selections.map((s) => { | 19 | selections: editor.selections.map((s) => { |
20 | return Server.client.code2ProtocolConverter.asRange(s); | 20 | return Server.client.code2ProtocolConverter.asRange(s); |
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts new file mode 100644 index 000000000..dfdcd6454 --- /dev/null +++ b/editors/code/src/commands/index.ts | |||
@@ -0,0 +1,17 @@ | |||
1 | import * as applySourceChange from './apply_source_change'; | ||
2 | import * as extendSelection from './extend_selection'; | ||
3 | import * as joinLines from './join_lines'; | ||
4 | import * as matchingBrace from './matching_brace'; | ||
5 | import * as parentModule from './parent_module'; | ||
6 | import * as runnables from './runnables'; | ||
7 | import * as syntaxTree from './syntaxTree'; | ||
8 | |||
9 | export { | ||
10 | applySourceChange, | ||
11 | extendSelection, | ||
12 | joinLines, | ||
13 | matchingBrace, | ||
14 | parentModule, | ||
15 | runnables, | ||
16 | syntaxTree, | ||
17 | }; | ||
diff --git a/editors/code/src/commands/join_lines.ts b/editors/code/src/commands/join_lines.ts index 80ad4460b..526b698cc 100644 --- a/editors/code/src/commands/join_lines.ts +++ b/editors/code/src/commands/join_lines.ts | |||
@@ -11,7 +11,7 @@ interface JoinLinesParams { | |||
11 | 11 | ||
12 | export async function handle() { | 12 | export async function handle() { |
13 | const editor = vscode.window.activeTextEditor; | 13 | const editor = vscode.window.activeTextEditor; |
14 | if (editor == null || editor.document.languageId != 'rust') { return; } | 14 | if (editor == null || editor.document.languageId !== 'rust') { return; } |
15 | const request: JoinLinesParams = { | 15 | const request: JoinLinesParams = { |
16 | range: Server.client.code2ProtocolConverter.asRange(editor.selection), | 16 | range: Server.client.code2ProtocolConverter.asRange(editor.selection), |
17 | textDocument: { uri: editor.document.uri.toString() }, | 17 | textDocument: { uri: editor.document.uri.toString() }, |
diff --git a/editors/code/src/commands/matching_brace.ts b/editors/code/src/commands/matching_brace.ts index cf7f6bf8f..a80446a8f 100644 --- a/editors/code/src/commands/matching_brace.ts +++ b/editors/code/src/commands/matching_brace.ts | |||
@@ -10,7 +10,7 @@ interface FindMatchingBraceParams { | |||
10 | 10 | ||
11 | export async function handle() { | 11 | export async function handle() { |
12 | const editor = vscode.window.activeTextEditor; | 12 | const editor = vscode.window.activeTextEditor; |
13 | if (editor == null || editor.document.languageId != 'rust') { return; } | 13 | if (editor == null || editor.document.languageId !== 'rust') { return; } |
14 | const request: FindMatchingBraceParams = { | 14 | const request: FindMatchingBraceParams = { |
15 | textDocument: { uri: editor.document.uri.toString() }, | 15 | textDocument: { uri: editor.document.uri.toString() }, |
16 | offsets: editor.selections.map((s) => { | 16 | offsets: editor.selections.map((s) => { |
diff --git a/editors/code/src/commands/parent_module.ts b/editors/code/src/commands/parent_module.ts index 7d413c27a..d66fb3026 100644 --- a/editors/code/src/commands/parent_module.ts +++ b/editors/code/src/commands/parent_module.ts | |||
@@ -5,7 +5,7 @@ import { Server } from '../server'; | |||
5 | 5 | ||
6 | export async function handle() { | 6 | export async function handle() { |
7 | const editor = vscode.window.activeTextEditor; | 7 | const editor = vscode.window.activeTextEditor; |
8 | if (editor == null || editor.document.languageId != 'rust') { return; } | 8 | if (editor == null || editor.document.languageId !== 'rust') { return; } |
9 | const request: TextDocumentIdentifier = { | 9 | const request: TextDocumentIdentifier = { |
10 | uri: editor.document.uri.toString(), | 10 | uri: editor.document.uri.toString(), |
11 | }; | 11 | }; |
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 37db6ea10..40f590dce 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts | |||
@@ -59,7 +59,7 @@ function createTask(spec: Runnable): vscode.Task { | |||
59 | let prevRunnable: RunnableQuickPick | undefined; | 59 | let prevRunnable: RunnableQuickPick | undefined; |
60 | export async function handle() { | 60 | export async function handle() { |
61 | const editor = vscode.window.activeTextEditor; | 61 | const editor = vscode.window.activeTextEditor; |
62 | if (editor == null || editor.document.languageId != 'rust') { return; } | 62 | if (editor == null || editor.document.languageId !== 'rust') { return; } |
63 | const textDocument: lc.TextDocumentIdentifier = { | 63 | const textDocument: lc.TextDocumentIdentifier = { |
64 | uri: editor.document.uri.toString(), | 64 | uri: editor.document.uri.toString(), |
65 | }; | 65 | }; |
@@ -73,7 +73,7 @@ export async function handle() { | |||
73 | items.push(prevRunnable); | 73 | items.push(prevRunnable); |
74 | } | 74 | } |
75 | for (const r of runnables) { | 75 | for (const r of runnables) { |
76 | if (prevRunnable && JSON.stringify(prevRunnable.runnable) == JSON.stringify(r)) { | 76 | if (prevRunnable && JSON.stringify(prevRunnable.runnable) === JSON.stringify(r)) { |
77 | continue; | 77 | continue; |
78 | } | 78 | } |
79 | items.push(new RunnableQuickPick(r)); | 79 | items.push(new RunnableQuickPick(r)); |