diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/package-lock.json | 36 | ||||
-rw-r--r-- | editors/code/package.json | 4 | ||||
-rw-r--r-- | editors/code/src/config.ts | 39 | ||||
-rw-r--r-- | editors/code/src/inlay_hints.ts | 10 |
4 files changed, 55 insertions, 34 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index eb4f299a1..e11cffd68 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json | |||
@@ -109,9 +109,9 @@ | |||
109 | } | 109 | } |
110 | }, | 110 | }, |
111 | "@types/vscode": { | 111 | "@types/vscode": { |
112 | "version": "1.43.0", | 112 | "version": "1.44.0", |
113 | "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.43.0.tgz", | 113 | "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.44.0.tgz", |
114 | "integrity": "sha512-kIaR9qzd80rJOxePKpCB/mdy00mz8Apt2QA5Y6rdrKFn13QNFNeP3Hzmsf37Bwh/3cS7QjtAeGSK7wSqAU0sYQ==", | 114 | "integrity": "sha512-WJZtZlinE3meRdH+I7wTsIhpz/GLhqEQwmPGeh4s1irWLwMzCeTV8WZ+pgPTwrDXoafVUWwo1LiZ9HJVHFlJSQ==", |
115 | "dev": true | 115 | "dev": true |
116 | }, | 116 | }, |
117 | "@typescript-eslint/eslint-plugin": { | 117 | "@typescript-eslint/eslint-plugin": { |
@@ -1776,32 +1776,32 @@ | |||
1776 | } | 1776 | } |
1777 | }, | 1777 | }, |
1778 | "vscode-jsonrpc": { | 1778 | "vscode-jsonrpc": { |
1779 | "version": "5.0.1", | 1779 | "version": "5.1.0-next.1", |
1780 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.0.1.tgz", | 1780 | "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-5.1.0-next.1.tgz", |
1781 | "integrity": "sha512-JvONPptw3GAQGXlVV2utDcHx0BiY34FupW/kI6mZ5x06ER5DdPG/tXWMVHjTNULF5uKPOUUD0SaXg5QaubJL0A==" | 1781 | "integrity": "sha512-mwLDojZkbmpizSJSmp690oa9FB9jig18SIDGZeBCvFc2/LYSRvMm/WwWtMBJuJ1MfFh7rZXfQige4Uje5Z9NzA==" |
1782 | }, | 1782 | }, |
1783 | "vscode-languageclient": { | 1783 | "vscode-languageclient": { |
1784 | "version": "6.1.3", | 1784 | "version": "7.0.0-next.1", |
1785 | "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-6.1.3.tgz", | 1785 | "resolved": "https://registry.npmjs.org/vscode-languageclient/-/vscode-languageclient-7.0.0-next.1.tgz", |
1786 | "integrity": "sha512-YciJxk08iU5LmWu7j5dUt9/1OLjokKET6rME3cI4BRpiF6HZlusm2ZwPt0MYJ0lV5y43sZsQHhyon2xBg4ZJVA==", | 1786 | "integrity": "sha512-JrjCUhLpQZxQ5VpWpilOHDMhVsn0fdN5jBh1uFNhSr5c2loJvRdr9Km2EuSQOFfOQsBKx0+xvY8PbsypNEcJ6w==", |
1787 | "requires": { | 1787 | "requires": { |
1788 | "semver": "^6.3.0", | 1788 | "semver": "^6.3.0", |
1789 | "vscode-languageserver-protocol": "^3.15.3" | 1789 | "vscode-languageserver-protocol": "3.16.0-next.2" |
1790 | } | 1790 | } |
1791 | }, | 1791 | }, |
1792 | "vscode-languageserver-protocol": { | 1792 | "vscode-languageserver-protocol": { |
1793 | "version": "3.15.3", | 1793 | "version": "3.16.0-next.2", |
1794 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.15.3.tgz", | 1794 | "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.16.0-next.2.tgz", |
1795 | "integrity": "sha512-zrMuwHOAQRhjDSnflWdJG+O2ztMWss8GqUUB8dXLR/FPenwkiBNkMIJJYfSN6sgskvsF0rHAoBowNQfbyZnnvw==", | 1795 | "integrity": "sha512-atmkGT/W6tF0cx4SaWFYtFs2UeSeC28RPiap9myv2YZTaTCFvTBEPNWrU5QRKfkyM0tbgtGo6T3UCQ8tkDpjzA==", |
1796 | "requires": { | 1796 | "requires": { |
1797 | "vscode-jsonrpc": "^5.0.1", | 1797 | "vscode-jsonrpc": "5.1.0-next.1", |
1798 | "vscode-languageserver-types": "3.15.1" | 1798 | "vscode-languageserver-types": "3.16.0-next.1" |
1799 | } | 1799 | } |
1800 | }, | 1800 | }, |
1801 | "vscode-languageserver-types": { | 1801 | "vscode-languageserver-types": { |
1802 | "version": "3.15.1", | 1802 | "version": "3.16.0-next.1", |
1803 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.15.1.tgz", | 1803 | "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.16.0-next.1.tgz", |
1804 | "integrity": "sha512-+a9MPUQrNGRrGU630OGbYVQ+11iOIovjCkqxajPa9w57Sd5ruK8WQNsslzpa0x/QJqC8kRc2DUxWjIFwoNm4ZQ==" | 1804 | "integrity": "sha512-tZFUSbyjUcrh+qQf13ALX4QDdOfDX0cVaBFgy7ktJ0VwS7AW/yRKgGPSxVqqP9OCMNPdqP57O5q47w2pEwfaUg==" |
1805 | }, | 1805 | }, |
1806 | "which": { | 1806 | "which": { |
1807 | "version": "1.3.1", | 1807 | "version": "1.3.1", |
diff --git a/editors/code/package.json b/editors/code/package.json index 0bf7b6ae6..33bd66b40 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -34,14 +34,14 @@ | |||
34 | "dependencies": { | 34 | "dependencies": { |
35 | "jsonc-parser": "^2.2.1", | 35 | "jsonc-parser": "^2.2.1", |
36 | "node-fetch": "^2.6.0", | 36 | "node-fetch": "^2.6.0", |
37 | "vscode-languageclient": "6.1.3" | 37 | "vscode-languageclient": "7.0.0-next.1" |
38 | }, | 38 | }, |
39 | "devDependencies": { | 39 | "devDependencies": { |
40 | "@rollup/plugin-commonjs": "^11.0.2", | 40 | "@rollup/plugin-commonjs": "^11.0.2", |
41 | "@rollup/plugin-node-resolve": "^7.1.1", | 41 | "@rollup/plugin-node-resolve": "^7.1.1", |
42 | "@types/node": "^12.12.34", | 42 | "@types/node": "^12.12.34", |
43 | "@types/node-fetch": "^2.5.5", | 43 | "@types/node-fetch": "^2.5.5", |
44 | "@types/vscode": "^1.43.0", | 44 | "@types/vscode": "^1.44.0", |
45 | "@typescript-eslint/eslint-plugin": "^2.27.0", | 45 | "@typescript-eslint/eslint-plugin": "^2.27.0", |
46 | "@typescript-eslint/parser": "^2.27.0", | 46 | "@typescript-eslint/parser": "^2.27.0", |
47 | "eslint": "^6.8.0", | 47 | "eslint": "^6.8.0", |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 21c1c9f23..35a05131c 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -66,23 +66,44 @@ export class Config { | |||
66 | return vscode.workspace.getConfiguration(this.rootSection); | 66 | return vscode.workspace.getConfiguration(this.rootSection); |
67 | } | 67 | } |
68 | 68 | ||
69 | get serverPath() { return this.cfg.get<null | string>("serverPath")!; } | 69 | /** |
70 | get channel() { return this.cfg.get<UpdatesChannel>("updates.channel")!; } | 70 | * Beware that postfix `!` operator erases both `null` and `undefined`. |
71 | get askBeforeDownload() { return this.cfg.get<boolean>("updates.askBeforeDownload")!; } | 71 | * This is why the following doesn't work as expected: |
72 | get traceExtension() { return this.cfg.get<boolean>("trace.extension")!; } | 72 | * |
73 | * ```ts | ||
74 | * const nullableNum = vscode | ||
75 | * .workspace | ||
76 | * .getConfiguration | ||
77 | * .getConfiguration("rust-analyer") | ||
78 | * .get<number | null>(path)!; | ||
79 | * | ||
80 | * // What happens is that type of `nullableNum` is `number` but not `null | number`: | ||
81 | * const fullFledgedNum: number = nullableNum; | ||
82 | * ``` | ||
83 | * So this getter handles this quirk by not requiring the caller to use postfix `!` | ||
84 | */ | ||
85 | private get<T>(path: string): T { | ||
86 | return this.cfg.get<T>(path)!; | ||
87 | } | ||
88 | |||
89 | get serverPath() { return this.get<null | string>("serverPath"); } | ||
90 | get channel() { return this.get<UpdatesChannel>("updates.channel"); } | ||
91 | get askBeforeDownload() { return this.get<boolean>("updates.askBeforeDownload"); } | ||
92 | get traceExtension() { return this.get<boolean>("trace.extension"); } | ||
93 | |||
73 | 94 | ||
74 | get inlayHints() { | 95 | get inlayHints() { |
75 | return { | 96 | return { |
76 | typeHints: this.cfg.get<boolean>("inlayHints.typeHints")!, | 97 | typeHints: this.get<boolean>("inlayHints.typeHints"), |
77 | parameterHints: this.cfg.get<boolean>("inlayHints.parameterHints")!, | 98 | parameterHints: this.get<boolean>("inlayHints.parameterHints"), |
78 | chainingHints: this.cfg.get<boolean>("inlayHints.chainingHints")!, | 99 | chainingHints: this.get<boolean>("inlayHints.chainingHints"), |
79 | maxLength: this.cfg.get<null | number>("inlayHints.maxLength")!, | 100 | maxLength: this.get<null | number>("inlayHints.maxLength"), |
80 | }; | 101 | }; |
81 | } | 102 | } |
82 | 103 | ||
83 | get checkOnSave() { | 104 | get checkOnSave() { |
84 | return { | 105 | return { |
85 | command: this.cfg.get<string>("checkOnSave.command")!, | 106 | command: this.get<string>("checkOnSave.command"), |
86 | }; | 107 | }; |
87 | } | 108 | } |
88 | } | 109 | } |
diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index 6a8bd942e..da74f03d2 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts | |||
@@ -229,13 +229,13 @@ interface InlaysDecorations { | |||
229 | } | 229 | } |
230 | 230 | ||
231 | interface RustSourceFile { | 231 | interface RustSourceFile { |
232 | /* | 232 | /** |
233 | * Source of the token to cancel in-flight inlay hints request if any. | 233 | * Source of the token to cancel in-flight inlay hints request if any. |
234 | */ | 234 | */ |
235 | inlaysRequest: null | vscode.CancellationTokenSource; | 235 | inlaysRequest: null | vscode.CancellationTokenSource; |
236 | /** | 236 | /** |
237 | * Last applied decorations. | 237 | * Last applied decorations. |
238 | */ | 238 | */ |
239 | cachedDecorations: null | InlaysDecorations; | 239 | cachedDecorations: null | InlaysDecorations; |
240 | 240 | ||
241 | document: RustDocument; | 241 | document: RustDocument; |