Skip to content

Commit e72771e

Browse files
bors[bot]Veetaha
andauthored
Merge #2986
2986: vscode extension cleanup: migrate to prefer-const tslint rule r=matklad a=Veetaha Co-authored-by: Veetaha <gerzoh1@gmail.com>
2 parents d06e02d + 4204624 commit e72771e

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

editors/code/src/color_theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function loadThemeNamed(themeName: string): ColorTheme {
6969
);
7070
}
7171

72-
let themePaths = vscode.extensions.all
72+
const themePaths = vscode.extensions.all
7373
.filter(isTheme)
7474
.flatMap(ext => {
7575
return ext.packageJSON.contributes.themes

editors/code/src/commands/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function collectGarbage(ctx: Ctx): Cmd {
2121

2222
function showReferences(ctx: Ctx): Cmd {
2323
return (uri: string, position: lc.Position, locations: lc.Location[]) => {
24-
let client = ctx.client;
24+
const client = ctx.client;
2525
if (client) {
2626
vscode.commands.executeCommand(
2727
'editor.action.showReferences',

editors/code/src/ctx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export class Ctx {
2020
}
2121

2222
async restartServer() {
23-
let old = this.client;
23+
const old = this.client;
2424
if (old) {
2525
await old.stop();
2626
}

editors/code/src/highlighting.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function activateHighlighting(ctx: Ctx) {
4040
async (editor: vscode.TextEditor | undefined) => {
4141
if (!editor || editor.document.languageId !== 'rust') return;
4242
if (!ctx.config.highlightingOn) return;
43-
let client = ctx.client;
43+
const client = ctx.client;
4444
if (!client) return;
4545

4646
const params: lc.TextDocumentIdentifier = {
@@ -106,7 +106,7 @@ class Highlighter {
106106
}
107107

108108
public setHighlights(editor: vscode.TextEditor, highlights: Decoration[]) {
109-
let client = this.ctx.client;
109+
const client = this.ctx.client;
110110
if (!client) return;
111111
// Initialize decorations if necessary
112112
//
@@ -175,7 +175,7 @@ function initDecorations(): Map<string, vscode.TextEditorDecorationType> {
175175
const res = new Map();
176176
TAG_TO_SCOPES.forEach((scopes, tag) => {
177177
if (!scopes) throw `unmapped tag: ${tag}`;
178-
let rule = theme.lookup(scopes);
178+
const rule = theme.lookup(scopes);
179179
const decor = createDecorationFromTextmate(rule);
180180
res.set(tag, decor);
181181
});

editors/code/src/inlay_hints.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ class HintsUpdater {
127127
}
128128

129129
private async queryHints(documentUri: string): Promise<InlayHint[] | null> {
130-
let client = this.ctx.client;
130+
const client = this.ctx.client;
131131
if (!client) return null;
132132
const request: InlayHintsParams = {
133133
textDocument: { uri: documentUri },
134134
};
135-
let tokenSource = new vscode.CancellationTokenSource();
136-
let prev = this.pending.get(documentUri);
135+
const tokenSource = new vscode.CancellationTokenSource();
136+
const prev = this.pending.get(documentUri);
137137
if (prev) prev.cancel();
138138
this.pending.set(documentUri, tokenSource);
139139
try {

editors/code/tslint.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"semicolon": [
44
true,
55
"always"
6-
]
6+
],
7+
"prefer-const": true
78
}
89
}

0 commit comments

Comments
 (0)