Skip to content

Commit e4d2170

Browse files
bors[bot]matklad
andauthored
Merge #2711
2711: Add semicolons r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 parents c8b98c4 + ff0ceb3 commit e4d2170

14 files changed

+160
-38
lines changed

editors/code/package-lock.json

Lines changed: 113 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editors/code/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"vscode:prepublish": "rollup -c",
2020
"package": "vsce package",
2121
"watch": "tsc -watch -p ./",
22-
"fmt": "tsfmt -r"
22+
"fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix"
2323
},
2424
"dependencies": {
2525
"jsonc-parser": "^2.1.0",
@@ -35,6 +35,7 @@
3535
"@types/vscode": "^1.41.0",
3636
"rollup": "^1.27.14",
3737
"tslib": "^1.10.0",
38+
"tslint": "^5.20.1",
3839
"typescript": "^3.7.3",
3940
"typescript-formatter": "^7.2.2",
4041
"vsce": "^1.71.0"

editors/code/src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function createClient(config: Config): lc.LanguageClient {
7979
}
8080
},
8181
};
82-
res.registerProposedFeatures()
82+
res.registerProposedFeatures();
8383
return res;
8484
}
8585
function expandPathResolving(path: string) {

editors/code/src/color_theme.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,29 @@ export class ColorTheme {
3232
? [rule.scope]
3333
: rule.scope;
3434
for (const scope of scopes) {
35-
res.rules.set(scope, rule.settings)
35+
res.rules.set(scope, rule.settings);
3636
}
3737
}
38-
return res
38+
return res;
3939
}
4040

4141
lookup(scopes: string[]): TextMateRuleSettings {
42-
let res: TextMateRuleSettings = {}
42+
let res: TextMateRuleSettings = {};
4343
for (const scope of scopes) {
4444
this.rules.forEach((value, key) => {
4545
if (scope.startsWith(key)) {
46-
res = mergeRuleSettings(res, value)
46+
res = mergeRuleSettings(res, value);
4747
}
48-
})
48+
});
4949
}
50-
return res
50+
return res;
5151
}
5252

5353
mergeFrom(other: ColorTheme) {
5454
other.rules.forEach((value, key) => {
55-
const merged = mergeRuleSettings(this.rules.get(key), value)
56-
this.rules.set(key, merged)
57-
})
55+
const merged = mergeRuleSettings(this.rules.get(key), value);
56+
this.rules.set(key, merged);
57+
});
5858
}
5959
}
6060

@@ -73,23 +73,23 @@ function loadThemeNamed(themeName: string): ColorTheme {
7373
return ext.packageJSON.contributes.themes
7474
.filter((it: any) => (it.id || it.label) === themeName)
7575
.map((it: any) => path.join(ext.extensionPath, it.path));
76-
})
76+
});
7777

7878
const res = new ColorTheme();
7979
for (const themePath of themePaths) {
80-
res.mergeFrom(loadThemeFile(themePath))
80+
res.mergeFrom(loadThemeFile(themePath));
8181
}
8282

8383
const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations');
84-
res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? []))
84+
res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? []));
8585

8686
return res;
8787
}
8888

8989
function loadThemeFile(themePath: string): ColorTheme {
9090
let text;
9191
try {
92-
text = fs.readFileSync(themePath, 'utf8')
92+
text = fs.readFileSync(themePath, 'utf8');
9393
} catch {
9494
return new ColorTheme();
9595
}
@@ -119,5 +119,5 @@ function mergeRuleSettings(
119119
foreground: override.foreground ?? defaultSetting?.foreground,
120120
background: override.background ?? defaultSetting?.background,
121121
fontStyle: override.fontStyle ?? defaultSetting?.fontStyle,
122-
}
122+
};
123123
}

editors/code/src/commands/analyzer_status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class TextDocumentContentProvider
4949
_uri: vscode.Uri,
5050
): vscode.ProviderResult<string> {
5151
const editor = vscode.window.activeTextEditor;
52-
const client = this.ctx.client
52+
const client = this.ctx.client;
5353
if (!editor || !client) return '';
5454

5555
return client.sendRequest<string>(

editors/code/src/commands/expand_macro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class TextDocumentContentProvider
5252

5353
async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> {
5454
const editor = vscode.window.activeTextEditor;
55-
const client = this.ctx.client
55+
const client = this.ctx.client;
5656
if (!editor || !client) return '';
5757

5858
const position = editor.selection.active;

editors/code/src/commands/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ function showReferences(ctx: Ctx): Cmd {
3636
function applySourceChange(ctx: Ctx): Cmd {
3737
return async (change: sourceChange.SourceChange) => {
3838
sourceChange.applySourceChange(ctx, change);
39-
}
39+
};
4040
}
4141

4242
function reload(ctx: Ctx): Cmd {
4343
return async () => {
4444
vscode.window.showInformationMessage('Reloading rust-analyzer...');
4545
await ctx.restartServer();
46-
}
46+
};
4747
}
4848

4949
export {

editors/code/src/commands/syntax_tree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class TextDocumentContentProvider
7676

7777
provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> {
7878
const editor = vscode.window.activeTextEditor;
79-
const client = this.ctx.client
79+
const client = this.ctx.client;
8080
if (!editor || !client) return '';
8181

8282
let range: lc.Range | undefined;

editors/code/src/ctx.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as vscode from 'vscode';
22
import * as lc from 'vscode-languageclient';
33
import { Config } from './config';
4-
import { createClient } from './client'
4+
import { createClient } from './client';
55

66
export class Ctx {
77
readonly config: Config;
@@ -10,28 +10,28 @@ export class Ctx {
1010
// deal with it.
1111
//
1212
// Ideally, this should be replaced with async getter though.
13-
client: lc.LanguageClient | null = null
13+
client: lc.LanguageClient | null = null;
1414
private extCtx: vscode.ExtensionContext;
1515
private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = [];
1616

1717
constructor(extCtx: vscode.ExtensionContext) {
18-
this.config = new Config(extCtx)
18+
this.config = new Config(extCtx);
1919
this.extCtx = extCtx;
2020
}
2121

2222
async restartServer() {
2323
let old = this.client;
2424
if (old) {
25-
await old.stop()
25+
await old.stop();
2626
}
2727
this.client = null;
2828
const client = createClient(this.config);
2929
this.pushCleanup(client.start());
3030
await client.onReady();
3131

32-
this.client = client
32+
this.client = client;
3333
for (const hook of this.onDidRestartHooks) {
34-
hook(client)
34+
hook(client);
3535
}
3636
}
3737

@@ -80,7 +80,7 @@ export class Ctx {
8080
}
8181

8282
onDidRestart(hook: (client: lc.LanguageClient) => void) {
83-
this.onDidRestartHooks.push(hook)
83+
this.onDidRestartHooks.push(hook);
8484
}
8585
}
8686

editors/code/src/highlighting.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function activateHighlighting(ctx: Ctx) {
3030
highlighter.setHighlights(targetEditor, params.decorations);
3131
},
3232
);
33-
})
33+
});
3434

3535
vscode.workspace.onDidChangeConfiguration(
3636
_ => highlighter.removeHighlights(),
@@ -173,13 +173,13 @@ class Highlighter {
173173

174174
function initDecorations(): Map<string, vscode.TextEditorDecorationType> {
175175
const theme = ColorTheme.load();
176-
const res = new Map()
176+
const res = new Map();
177177
TAG_TO_SCOPES.forEach((scopes, tag) => {
178-
if (!scopes) throw `unmapped tag: ${tag}`
179-
let rule = theme.lookup(scopes)
178+
if (!scopes) throw `unmapped tag: ${tag}`;
179+
let rule = theme.lookup(scopes);
180180
const decor = createDecorationFromTextmate(rule);
181-
res.set(tag, decor)
182-
})
181+
res.set(tag, decor);
182+
});
183183
return res;
184184
}
185185

0 commit comments

Comments
 (0)