aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-02-02 19:12:59 +0000
committerVeetaha <[email protected]>2020-02-02 19:12:59 +0000
commit420462421d87a05c926501f8d4235f7660217924 (patch)
tree681e88118603403c70de2e92d2a3cf3502bff2a0 /editors/code
parentd06e02dd13e7cf10d53203620592aa0e85d808c0 (diff)
vscode extension cleanup: migrate to prefer-const tslint rule
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/src/color_theme.ts2
-rw-r--r--editors/code/src/commands/index.ts2
-rw-r--r--editors/code/src/ctx.ts2
-rw-r--r--editors/code/src/highlighting.ts6
-rw-r--r--editors/code/src/inlay_hints.ts6
-rw-r--r--editors/code/tslint.json3
6 files changed, 11 insertions, 10 deletions
diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts
index d816f617d..71113d374 100644
--- a/editors/code/src/color_theme.ts
+++ b/editors/code/src/color_theme.ts
@@ -69,7 +69,7 @@ function loadThemeNamed(themeName: string): ColorTheme {
69 ); 69 );
70 } 70 }
71 71
72 let themePaths = vscode.extensions.all 72 const themePaths = vscode.extensions.all
73 .filter(isTheme) 73 .filter(isTheme)
74 .flatMap(ext => { 74 .flatMap(ext => {
75 return ext.packageJSON.contributes.themes 75 return ext.packageJSON.contributes.themes
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts
index dc075aa82..4501809e2 100644
--- a/editors/code/src/commands/index.ts
+++ b/editors/code/src/commands/index.ts
@@ -21,7 +21,7 @@ function collectGarbage(ctx: Ctx): Cmd {
21 21
22function showReferences(ctx: Ctx): Cmd { 22function showReferences(ctx: Ctx): Cmd {
23 return (uri: string, position: lc.Position, locations: lc.Location[]) => { 23 return (uri: string, position: lc.Position, locations: lc.Location[]) => {
24 let client = ctx.client; 24 const client = ctx.client;
25 if (client) { 25 if (client) {
26 vscode.commands.executeCommand( 26 vscode.commands.executeCommand(
27 'editor.action.showReferences', 27 'editor.action.showReferences',
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index a2a4e42a9..b882a8e52 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -20,7 +20,7 @@ export class Ctx {
20 } 20 }
21 21
22 async restartServer() { 22 async restartServer() {
23 let old = this.client; 23 const old = this.client;
24 if (old) { 24 if (old) {
25 await old.stop(); 25 await old.stop();
26 } 26 }
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts
index fc7cd5a1c..3d190c3ad 100644
--- a/editors/code/src/highlighting.ts
+++ b/editors/code/src/highlighting.ts
@@ -40,7 +40,7 @@ export function activateHighlighting(ctx: Ctx) {
40 async (editor: vscode.TextEditor | undefined) => { 40 async (editor: vscode.TextEditor | undefined) => {
41 if (!editor || editor.document.languageId !== 'rust') return; 41 if (!editor || editor.document.languageId !== 'rust') return;
42 if (!ctx.config.highlightingOn) return; 42 if (!ctx.config.highlightingOn) return;
43 let client = ctx.client; 43 const client = ctx.client;
44 if (!client) return; 44 if (!client) return;
45 45
46 const params: lc.TextDocumentIdentifier = { 46 const params: lc.TextDocumentIdentifier = {
@@ -106,7 +106,7 @@ class Highlighter {
106 } 106 }
107 107
108 public setHighlights(editor: vscode.TextEditor, highlights: Decoration[]) { 108 public setHighlights(editor: vscode.TextEditor, highlights: Decoration[]) {
109 let client = this.ctx.client; 109 const client = this.ctx.client;
110 if (!client) return; 110 if (!client) return;
111 // Initialize decorations if necessary 111 // Initialize decorations if necessary
112 // 112 //
@@ -175,7 +175,7 @@ function initDecorations(): Map<string, vscode.TextEditorDecorationType> {
175 const res = new Map(); 175 const res = new Map();
176 TAG_TO_SCOPES.forEach((scopes, tag) => { 176 TAG_TO_SCOPES.forEach((scopes, tag) => {
177 if (!scopes) throw `unmapped tag: ${tag}`; 177 if (!scopes) throw `unmapped tag: ${tag}`;
178 let rule = theme.lookup(scopes); 178 const rule = theme.lookup(scopes);
179 const decor = createDecorationFromTextmate(rule); 179 const decor = createDecorationFromTextmate(rule);
180 res.set(tag, decor); 180 res.set(tag, decor);
181 }); 181 });
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts
index 6357e44f1..ae7510183 100644
--- a/editors/code/src/inlay_hints.ts
+++ b/editors/code/src/inlay_hints.ts
@@ -127,13 +127,13 @@ class HintsUpdater {
127 } 127 }
128 128
129 private async queryHints(documentUri: string): Promise<InlayHint[] | null> { 129 private async queryHints(documentUri: string): Promise<InlayHint[] | null> {
130 let client = this.ctx.client; 130 const client = this.ctx.client;
131 if (!client) return null; 131 if (!client) return null;
132 const request: InlayHintsParams = { 132 const request: InlayHintsParams = {
133 textDocument: { uri: documentUri }, 133 textDocument: { uri: documentUri },
134 }; 134 };
135 let tokenSource = new vscode.CancellationTokenSource(); 135 const tokenSource = new vscode.CancellationTokenSource();
136 let prev = this.pending.get(documentUri); 136 const prev = this.pending.get(documentUri);
137 if (prev) prev.cancel(); 137 if (prev) prev.cancel();
138 this.pending.set(documentUri, tokenSource); 138 this.pending.set(documentUri, tokenSource);
139 try { 139 try {
diff --git a/editors/code/tslint.json b/editors/code/tslint.json
index 318e02b4b..0df11b2f1 100644
--- a/editors/code/tslint.json
+++ b/editors/code/tslint.json
@@ -3,6 +3,7 @@
3 "semicolon": [ 3 "semicolon": [
4 true, 4 true,
5 "always" 5 "always"
6 ] 6 ],
7 "prefer-const": true
7 } 8 }
8} 9}