diff options
author | Aleksey Kladov <[email protected]> | 2019-12-31 17:55:34 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-31 17:55:34 +0000 |
commit | ff0ceb30a9ab4162d0f1241d8b0f9aa531c3c9d2 (patch) | |
tree | 1df182b9755a83c460c928ad8a0bf5ff76548e3c /editors | |
parent | cb41ffbbbdea66d3a0abae4d270da1224a5de91c (diff) |
Add semicolons
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/package-lock.json | 113 | ||||
-rw-r--r-- | editors/code/package.json | 3 | ||||
-rw-r--r-- | editors/code/src/client.ts | 2 | ||||
-rw-r--r-- | editors/code/src/color_theme.ts | 28 | ||||
-rw-r--r-- | editors/code/src/commands/analyzer_status.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/expand_macro.ts | 2 | ||||
-rw-r--r-- | editors/code/src/commands/index.ts | 4 | ||||
-rw-r--r-- | editors/code/src/commands/syntax_tree.ts | 2 | ||||
-rw-r--r-- | editors/code/src/ctx.ts | 14 | ||||
-rw-r--r-- | editors/code/src/highlighting.ts | 12 | ||||
-rw-r--r-- | editors/code/src/inlay_hints.ts | 4 | ||||
-rw-r--r-- | editors/code/src/source_change.ts | 2 | ||||
-rw-r--r-- | editors/code/src/status_display.ts | 2 | ||||
-rw-r--r-- | editors/code/tslint.json | 8 |
14 files changed, 160 insertions, 38 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index a7e32e288..adb01760a 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json | |||
@@ -4,6 +4,26 @@ | |||
4 | "lockfileVersion": 1, | 4 | "lockfileVersion": 1, |
5 | "requires": true, | 5 | "requires": true, |
6 | "dependencies": { | 6 | "dependencies": { |
7 | "@babel/code-frame": { | ||
8 | "version": "7.5.5", | ||
9 | "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", | ||
10 | "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", | ||
11 | "dev": true, | ||
12 | "requires": { | ||
13 | "@babel/highlight": "^7.0.0" | ||
14 | } | ||
15 | }, | ||
16 | "@babel/highlight": { | ||
17 | "version": "7.5.0", | ||
18 | "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", | ||
19 | "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", | ||
20 | "dev": true, | ||
21 | "requires": { | ||
22 | "chalk": "^2.0.0", | ||
23 | "esutils": "^2.0.2", | ||
24 | "js-tokens": "^4.0.0" | ||
25 | } | ||
26 | }, | ||
7 | "@rollup/plugin-commonjs": { | 27 | "@rollup/plugin-commonjs": { |
8 | "version": "11.0.0", | 28 | "version": "11.0.0", |
9 | "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.0.tgz", | 29 | "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-11.0.0.tgz", |
@@ -240,6 +260,12 @@ | |||
240 | "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", | 260 | "integrity": "sha1-6S7f2tplN9SE1zwBcv0eugxJdv8=", |
241 | "dev": true | 261 | "dev": true |
242 | }, | 262 | }, |
263 | "diff": { | ||
264 | "version": "4.0.1", | ||
265 | "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", | ||
266 | "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", | ||
267 | "dev": true | ||
268 | }, | ||
243 | "dom-serializer": { | 269 | "dom-serializer": { |
244 | "version": "0.1.1", | 270 | "version": "0.1.1", |
245 | "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", | 271 | "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.1.tgz", |
@@ -307,12 +333,24 @@ | |||
307 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", | 333 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", |
308 | "dev": true | 334 | "dev": true |
309 | }, | 335 | }, |
336 | "esprima": { | ||
337 | "version": "4.0.1", | ||
338 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", | ||
339 | "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", | ||
340 | "dev": true | ||
341 | }, | ||
310 | "estree-walker": { | 342 | "estree-walker": { |
311 | "version": "0.6.1", | 343 | "version": "0.6.1", |
312 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", | 344 | "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", |
313 | "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", | 345 | "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", |
314 | "dev": true | 346 | "dev": true |
315 | }, | 347 | }, |
348 | "esutils": { | ||
349 | "version": "2.0.3", | ||
350 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", | ||
351 | "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", | ||
352 | "dev": true | ||
353 | }, | ||
316 | "fd-slicer": { | 354 | "fd-slicer": { |
317 | "version": "1.1.0", | 355 | "version": "1.1.0", |
318 | "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", | 356 | "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", |
@@ -401,6 +439,22 @@ | |||
401 | } | 439 | } |
402 | } | 440 | } |
403 | }, | 441 | }, |
442 | "js-tokens": { | ||
443 | "version": "4.0.0", | ||
444 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", | ||
445 | "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", | ||
446 | "dev": true | ||
447 | }, | ||
448 | "js-yaml": { | ||
449 | "version": "3.13.1", | ||
450 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", | ||
451 | "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", | ||
452 | "dev": true, | ||
453 | "requires": { | ||
454 | "argparse": "^1.0.7", | ||
455 | "esprima": "^4.0.0" | ||
456 | } | ||
457 | }, | ||
404 | "jsonc-parser": { | 458 | "jsonc-parser": { |
405 | "version": "2.2.0", | 459 | "version": "2.2.0", |
406 | "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", | 460 | "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-2.2.0.tgz", |
@@ -474,6 +528,21 @@ | |||
474 | "brace-expansion": "^1.1.7" | 528 | "brace-expansion": "^1.1.7" |
475 | } | 529 | } |
476 | }, | 530 | }, |
531 | "minimist": { | ||
532 | "version": "0.0.8", | ||
533 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", | ||
534 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", | ||
535 | "dev": true | ||
536 | }, | ||
537 | "mkdirp": { | ||
538 | "version": "0.5.1", | ||
539 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", | ||
540 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", | ||
541 | "dev": true, | ||
542 | "requires": { | ||
543 | "minimist": "0.0.8" | ||
544 | } | ||
545 | }, | ||
477 | "mute-stream": { | 546 | "mute-stream": { |
478 | "version": "0.0.8", | 547 | "version": "0.0.8", |
479 | "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", | 548 | "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", |
@@ -683,6 +752,50 @@ | |||
683 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", | 752 | "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", |
684 | "dev": true | 753 | "dev": true |
685 | }, | 754 | }, |
755 | "tslint": { | ||
756 | "version": "5.20.1", | ||
757 | "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", | ||
758 | "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", | ||
759 | "dev": true, | ||
760 | "requires": { | ||
761 | "@babel/code-frame": "^7.0.0", | ||
762 | "builtin-modules": "^1.1.1", | ||
763 | "chalk": "^2.3.0", | ||
764 | "commander": "^2.12.1", | ||
765 | "diff": "^4.0.1", | ||
766 | "glob": "^7.1.1", | ||
767 | "js-yaml": "^3.13.1", | ||
768 | "minimatch": "^3.0.4", | ||
769 | "mkdirp": "^0.5.1", | ||
770 | "resolve": "^1.3.2", | ||
771 | "semver": "^5.3.0", | ||
772 | "tslib": "^1.8.0", | ||
773 | "tsutils": "^2.29.0" | ||
774 | }, | ||
775 | "dependencies": { | ||
776 | "builtin-modules": { | ||
777 | "version": "1.1.1", | ||
778 | "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", | ||
779 | "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", | ||
780 | "dev": true | ||
781 | }, | ||
782 | "semver": { | ||
783 | "version": "5.7.1", | ||
784 | "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", | ||
785 | "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", | ||
786 | "dev": true | ||
787 | } | ||
788 | } | ||
789 | }, | ||
790 | "tsutils": { | ||
791 | "version": "2.29.0", | ||
792 | "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", | ||
793 | "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", | ||
794 | "dev": true, | ||
795 | "requires": { | ||
796 | "tslib": "^1.8.1" | ||
797 | } | ||
798 | }, | ||
686 | "tunnel": { | 799 | "tunnel": { |
687 | "version": "0.0.4", | 800 | "version": "0.0.4", |
688 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", | 801 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.4.tgz", |
diff --git a/editors/code/package.json b/editors/code/package.json index 429d63f72..7d809a2d3 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -19,7 +19,7 @@ | |||
19 | "vscode:prepublish": "rollup -c", | 19 | "vscode:prepublish": "rollup -c", |
20 | "package": "vsce package", | 20 | "package": "vsce package", |
21 | "watch": "tsc -watch -p ./", | 21 | "watch": "tsc -watch -p ./", |
22 | "fmt": "tsfmt -r" | 22 | "fmt": "tsfmt -r && tslint -c tslint.json 'src/**/*.ts' --fix" |
23 | }, | 23 | }, |
24 | "dependencies": { | 24 | "dependencies": { |
25 | "jsonc-parser": "^2.1.0", | 25 | "jsonc-parser": "^2.1.0", |
@@ -35,6 +35,7 @@ | |||
35 | "@types/vscode": "^1.41.0", | 35 | "@types/vscode": "^1.41.0", |
36 | "rollup": "^1.27.14", | 36 | "rollup": "^1.27.14", |
37 | "tslib": "^1.10.0", | 37 | "tslib": "^1.10.0", |
38 | "tslint": "^5.20.1", | ||
38 | "typescript": "^3.7.3", | 39 | "typescript": "^3.7.3", |
39 | "typescript-formatter": "^7.2.2", | 40 | "typescript-formatter": "^7.2.2", |
40 | "vsce": "^1.71.0" | 41 | "vsce": "^1.71.0" |
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 94948b10f..743384bd7 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts | |||
@@ -79,7 +79,7 @@ export function createClient(config: Config): lc.LanguageClient { | |||
79 | } | 79 | } |
80 | }, | 80 | }, |
81 | }; | 81 | }; |
82 | res.registerProposedFeatures() | 82 | res.registerProposedFeatures(); |
83 | return res; | 83 | return res; |
84 | } | 84 | } |
85 | function expandPathResolving(path: string) { | 85 | function expandPathResolving(path: string) { |
diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts index 1df7eba7a..cbad47f35 100644 --- a/editors/code/src/color_theme.ts +++ b/editors/code/src/color_theme.ts | |||
@@ -32,29 +32,29 @@ export class ColorTheme { | |||
32 | ? [rule.scope] | 32 | ? [rule.scope] |
33 | : rule.scope; | 33 | : rule.scope; |
34 | for (const scope of scopes) { | 34 | for (const scope of scopes) { |
35 | res.rules.set(scope, rule.settings) | 35 | res.rules.set(scope, rule.settings); |
36 | } | 36 | } |
37 | } | 37 | } |
38 | return res | 38 | return res; |
39 | } | 39 | } |
40 | 40 | ||
41 | lookup(scopes: string[]): TextMateRuleSettings { | 41 | lookup(scopes: string[]): TextMateRuleSettings { |
42 | let res: TextMateRuleSettings = {} | 42 | let res: TextMateRuleSettings = {}; |
43 | for (const scope of scopes) { | 43 | for (const scope of scopes) { |
44 | this.rules.forEach((value, key) => { | 44 | this.rules.forEach((value, key) => { |
45 | if (scope.startsWith(key)) { | 45 | if (scope.startsWith(key)) { |
46 | res = mergeRuleSettings(res, value) | 46 | res = mergeRuleSettings(res, value); |
47 | } | 47 | } |
48 | }) | 48 | }); |
49 | } | 49 | } |
50 | return res | 50 | return res; |
51 | } | 51 | } |
52 | 52 | ||
53 | mergeFrom(other: ColorTheme) { | 53 | mergeFrom(other: ColorTheme) { |
54 | other.rules.forEach((value, key) => { | 54 | other.rules.forEach((value, key) => { |
55 | const merged = mergeRuleSettings(this.rules.get(key), value) | 55 | const merged = mergeRuleSettings(this.rules.get(key), value); |
56 | this.rules.set(key, merged) | 56 | this.rules.set(key, merged); |
57 | }) | 57 | }); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
@@ -73,15 +73,15 @@ function loadThemeNamed(themeName: string): ColorTheme { | |||
73 | return ext.packageJSON.contributes.themes | 73 | return ext.packageJSON.contributes.themes |
74 | .filter((it: any) => (it.id || it.label) === themeName) | 74 | .filter((it: any) => (it.id || it.label) === themeName) |
75 | .map((it: any) => path.join(ext.extensionPath, it.path)); | 75 | .map((it: any) => path.join(ext.extensionPath, it.path)); |
76 | }) | 76 | }); |
77 | 77 | ||
78 | const res = new ColorTheme(); | 78 | const res = new ColorTheme(); |
79 | for (const themePath of themePaths) { | 79 | for (const themePath of themePaths) { |
80 | res.mergeFrom(loadThemeFile(themePath)) | 80 | res.mergeFrom(loadThemeFile(themePath)); |
81 | } | 81 | } |
82 | 82 | ||
83 | const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); | 83 | const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); |
84 | res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])) | 84 | res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])); |
85 | 85 | ||
86 | return res; | 86 | return res; |
87 | } | 87 | } |
@@ -89,7 +89,7 @@ function loadThemeNamed(themeName: string): ColorTheme { | |||
89 | function loadThemeFile(themePath: string): ColorTheme { | 89 | function loadThemeFile(themePath: string): ColorTheme { |
90 | let text; | 90 | let text; |
91 | try { | 91 | try { |
92 | text = fs.readFileSync(themePath, 'utf8') | 92 | text = fs.readFileSync(themePath, 'utf8'); |
93 | } catch { | 93 | } catch { |
94 | return new ColorTheme(); | 94 | return new ColorTheme(); |
95 | } | 95 | } |
@@ -119,5 +119,5 @@ function mergeRuleSettings( | |||
119 | foreground: override.foreground ?? defaultSetting?.foreground, | 119 | foreground: override.foreground ?? defaultSetting?.foreground, |
120 | background: override.background ?? defaultSetting?.background, | 120 | background: override.background ?? defaultSetting?.background, |
121 | fontStyle: override.fontStyle ?? defaultSetting?.fontStyle, | 121 | fontStyle: override.fontStyle ?? defaultSetting?.fontStyle, |
122 | } | 122 | }; |
123 | } | 123 | } |
diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts index cf37dc6f0..cfe7d1af0 100644 --- a/editors/code/src/commands/analyzer_status.ts +++ b/editors/code/src/commands/analyzer_status.ts | |||
@@ -49,7 +49,7 @@ class TextDocumentContentProvider | |||
49 | _uri: vscode.Uri, | 49 | _uri: vscode.Uri, |
50 | ): vscode.ProviderResult<string> { | 50 | ): vscode.ProviderResult<string> { |
51 | const editor = vscode.window.activeTextEditor; | 51 | const editor = vscode.window.activeTextEditor; |
52 | const client = this.ctx.client | 52 | const client = this.ctx.client; |
53 | if (!editor || !client) return ''; | 53 | if (!editor || !client) return ''; |
54 | 54 | ||
55 | return client.sendRequest<string>( | 55 | return client.sendRequest<string>( |
diff --git a/editors/code/src/commands/expand_macro.ts b/editors/code/src/commands/expand_macro.ts index 472f43b8d..dcdde78af 100644 --- a/editors/code/src/commands/expand_macro.ts +++ b/editors/code/src/commands/expand_macro.ts | |||
@@ -52,7 +52,7 @@ class TextDocumentContentProvider | |||
52 | 52 | ||
53 | async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> { | 53 | async provideTextDocumentContent(_uri: vscode.Uri): Promise<string> { |
54 | const editor = vscode.window.activeTextEditor; | 54 | const editor = vscode.window.activeTextEditor; |
55 | const client = this.ctx.client | 55 | const client = this.ctx.client; |
56 | if (!editor || !client) return ''; | 56 | if (!editor || !client) return ''; |
57 | 57 | ||
58 | const position = editor.selection.active; | 58 | const position = editor.selection.active; |
diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index 4431fdcf6..9a1697dcb 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts | |||
@@ -36,14 +36,14 @@ function showReferences(ctx: Ctx): Cmd { | |||
36 | function applySourceChange(ctx: Ctx): Cmd { | 36 | function applySourceChange(ctx: Ctx): Cmd { |
37 | return async (change: sourceChange.SourceChange) => { | 37 | return async (change: sourceChange.SourceChange) => { |
38 | sourceChange.applySourceChange(ctx, change); | 38 | sourceChange.applySourceChange(ctx, change); |
39 | } | 39 | }; |
40 | } | 40 | } |
41 | 41 | ||
42 | function reload(ctx: Ctx): Cmd { | 42 | function reload(ctx: Ctx): Cmd { |
43 | return async () => { | 43 | return async () => { |
44 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); | 44 | vscode.window.showInformationMessage('Reloading rust-analyzer...'); |
45 | await ctx.restartServer(); | 45 | await ctx.restartServer(); |
46 | } | 46 | }; |
47 | } | 47 | } |
48 | 48 | ||
49 | export { | 49 | export { |
diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index 2ee80f910..02ea9f166 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts | |||
@@ -76,7 +76,7 @@ class TextDocumentContentProvider | |||
76 | 76 | ||
77 | provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> { | 77 | provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult<string> { |
78 | const editor = vscode.window.activeTextEditor; | 78 | const editor = vscode.window.activeTextEditor; |
79 | const client = this.ctx.client | 79 | const client = this.ctx.client; |
80 | if (!editor || !client) return ''; | 80 | if (!editor || !client) return ''; |
81 | 81 | ||
82 | let range: lc.Range | undefined; | 82 | let range: lc.Range | undefined; |
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 13988056a..a2a4e42a9 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as vscode from 'vscode'; | 1 | import * as vscode from 'vscode'; |
2 | import * as lc from 'vscode-languageclient'; | 2 | import * as lc from 'vscode-languageclient'; |
3 | import { Config } from './config'; | 3 | import { Config } from './config'; |
4 | import { createClient } from './client' | 4 | import { createClient } from './client'; |
5 | 5 | ||
6 | export class Ctx { | 6 | export class Ctx { |
7 | readonly config: Config; | 7 | readonly config: Config; |
@@ -10,28 +10,28 @@ export class Ctx { | |||
10 | // deal with it. | 10 | // deal with it. |
11 | // | 11 | // |
12 | // Ideally, this should be replaced with async getter though. | 12 | // Ideally, this should be replaced with async getter though. |
13 | client: lc.LanguageClient | null = null | 13 | client: lc.LanguageClient | null = null; |
14 | private extCtx: vscode.ExtensionContext; | 14 | private extCtx: vscode.ExtensionContext; |
15 | private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; | 15 | private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; |
16 | 16 | ||
17 | constructor(extCtx: vscode.ExtensionContext) { | 17 | constructor(extCtx: vscode.ExtensionContext) { |
18 | this.config = new Config(extCtx) | 18 | this.config = new Config(extCtx); |
19 | this.extCtx = extCtx; | 19 | this.extCtx = extCtx; |
20 | } | 20 | } |
21 | 21 | ||
22 | async restartServer() { | 22 | async restartServer() { |
23 | let old = this.client; | 23 | let old = this.client; |
24 | if (old) { | 24 | if (old) { |
25 | await old.stop() | 25 | await old.stop(); |
26 | } | 26 | } |
27 | this.client = null; | 27 | this.client = null; |
28 | const client = createClient(this.config); | 28 | const client = createClient(this.config); |
29 | this.pushCleanup(client.start()); | 29 | this.pushCleanup(client.start()); |
30 | await client.onReady(); | 30 | await client.onReady(); |
31 | 31 | ||
32 | this.client = client | 32 | this.client = client; |
33 | for (const hook of this.onDidRestartHooks) { | 33 | for (const hook of this.onDidRestartHooks) { |
34 | hook(client) | 34 | hook(client); |
35 | } | 35 | } |
36 | } | 36 | } |
37 | 37 | ||
@@ -80,7 +80,7 @@ export class Ctx { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | onDidRestart(hook: (client: lc.LanguageClient) => void) { | 82 | onDidRestart(hook: (client: lc.LanguageClient) => void) { |
83 | this.onDidRestartHooks.push(hook) | 83 | this.onDidRestartHooks.push(hook); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index f9d2e9d90..014e96f75 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts | |||
@@ -30,7 +30,7 @@ export function activateHighlighting(ctx: Ctx) { | |||
30 | highlighter.setHighlights(targetEditor, params.decorations); | 30 | highlighter.setHighlights(targetEditor, params.decorations); |
31 | }, | 31 | }, |
32 | ); | 32 | ); |
33 | }) | 33 | }); |
34 | 34 | ||
35 | vscode.workspace.onDidChangeConfiguration( | 35 | vscode.workspace.onDidChangeConfiguration( |
36 | _ => highlighter.removeHighlights(), | 36 | _ => highlighter.removeHighlights(), |
@@ -173,13 +173,13 @@ class Highlighter { | |||
173 | 173 | ||
174 | function initDecorations(): Map<string, vscode.TextEditorDecorationType> { | 174 | function initDecorations(): Map<string, vscode.TextEditorDecorationType> { |
175 | const theme = ColorTheme.load(); | 175 | const theme = ColorTheme.load(); |
176 | const res = new Map() | 176 | const res = new Map(); |
177 | TAG_TO_SCOPES.forEach((scopes, tag) => { | 177 | TAG_TO_SCOPES.forEach((scopes, tag) => { |
178 | if (!scopes) throw `unmapped tag: ${tag}` | 178 | if (!scopes) throw `unmapped tag: ${tag}`; |
179 | let rule = theme.lookup(scopes) | 179 | let rule = theme.lookup(scopes); |
180 | const decor = createDecorationFromTextmate(rule); | 180 | const decor = createDecorationFromTextmate(rule); |
181 | res.set(tag, decor) | 181 | res.set(tag, decor); |
182 | }) | 182 | }); |
183 | return res; | 183 | return res; |
184 | } | 184 | } |
185 | 185 | ||
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index e74d6996f..6dd767d72 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts | |||
@@ -19,7 +19,7 @@ export function activateInlayHints(ctx: Ctx) { | |||
19 | hintsUpdater.setEnabled(ctx.config.displayInlayHints); | 19 | hintsUpdater.setEnabled(ctx.config.displayInlayHints); |
20 | }, ctx.subscriptions); | 20 | }, ctx.subscriptions); |
21 | 21 | ||
22 | ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)) | 22 | ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); |
23 | } | 23 | } |
24 | 24 | ||
25 | interface InlayHintsParams { | 25 | interface InlayHintsParams { |
@@ -96,7 +96,7 @@ class HintsUpdater { | |||
96 | 96 | ||
97 | private async queryHints(documentUri: string): Promise<InlayHint[] | null> { | 97 | private async queryHints(documentUri: string): Promise<InlayHint[] | null> { |
98 | let client = this.ctx.client; | 98 | let client = this.ctx.client; |
99 | if (!client) return null | 99 | if (!client) return null; |
100 | const request: InlayHintsParams = { | 100 | const request: InlayHintsParams = { |
101 | textDocument: { uri: documentUri }, | 101 | textDocument: { uri: documentUri }, |
102 | }; | 102 | }; |
diff --git a/editors/code/src/source_change.ts b/editors/code/src/source_change.ts index 887191d9e..a336269ba 100644 --- a/editors/code/src/source_change.ts +++ b/editors/code/src/source_change.ts | |||
@@ -11,7 +11,7 @@ export interface SourceChange { | |||
11 | 11 | ||
12 | export async function applySourceChange(ctx: Ctx, change: SourceChange) { | 12 | export async function applySourceChange(ctx: Ctx, change: SourceChange) { |
13 | const client = ctx.client; | 13 | const client = ctx.client; |
14 | if (!client) return | 14 | if (!client) return; |
15 | 15 | ||
16 | const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit( | 16 | const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit( |
17 | change.workspaceEdit, | 17 | change.workspaceEdit, |
diff --git a/editors/code/src/status_display.ts b/editors/code/src/status_display.ts index 1454bf8b0..08cdc8bdf 100644 --- a/editors/code/src/status_display.ts +++ b/editors/code/src/status_display.ts | |||
@@ -9,7 +9,7 @@ export function activateStatusDisplay(ctx: Ctx) { | |||
9 | ctx.pushCleanup(statusDisplay); | 9 | ctx.pushCleanup(statusDisplay); |
10 | ctx.onDidRestart(client => { | 10 | ctx.onDidRestart(client => { |
11 | client.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); | 11 | client.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); |
12 | }) | 12 | }); |
13 | } | 13 | } |
14 | 14 | ||
15 | class StatusDisplay implements vscode.Disposable { | 15 | class StatusDisplay implements vscode.Disposable { |
diff --git a/editors/code/tslint.json b/editors/code/tslint.json new file mode 100644 index 000000000..318e02b4b --- /dev/null +++ b/editors/code/tslint.json | |||
@@ -0,0 +1,8 @@ | |||
1 | { | ||
2 | "rules": { | ||
3 | "semicolon": [ | ||
4 | true, | ||
5 | "always" | ||
6 | ] | ||
7 | } | ||
8 | } | ||