diff options
author | Benjamin Coenen <[email protected]> | 2020-04-09 08:39:17 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-04-09 08:53:53 +0100 |
commit | 585bb83e2aec9c79dae8c2e031e9165f40937003 (patch) | |
tree | 3dda062f3deb768b211e7e091dd5b29b9b6fae84 /editors/code | |
parent | 8f1dba6f9ae1d8d314dd9d007e4c582ed1403e8d (diff) | |
parent | 080c983498afcac3eb54028af5c9f8bfe7f2c826 (diff) |
feat: add attributes support on struct fields and method #3870
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'editors/code')
-rw-r--r-- | editors/code/package-lock.json | 44 | ||||
-rw-r--r-- | editors/code/package.json | 13 | ||||
-rw-r--r-- | editors/code/src/client.ts | 16 | ||||
-rw-r--r-- | editors/code/src/config.ts | 1 | ||||
-rw-r--r-- | editors/code/src/ctx.ts | 2 |
5 files changed, 33 insertions, 43 deletions
diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index d5dec8fc5..eb4f299a1 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json | |||
@@ -115,25 +115,25 @@ | |||
115 | "dev": true | 115 | "dev": true |
116 | }, | 116 | }, |
117 | "@typescript-eslint/eslint-plugin": { | 117 | "@typescript-eslint/eslint-plugin": { |
118 | "version": "2.26.0", | 118 | "version": "2.27.0", |
119 | "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.26.0.tgz", | 119 | "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.27.0.tgz", |
120 | "integrity": "sha512-4yUnLv40bzfzsXcTAtZyTjbiGUXMrcIJcIMioI22tSOyAxpdXiZ4r7YQUU8Jj6XXrLz9d5aMHPQf5JFR7h27Nw==", | 120 | "integrity": "sha512-/my+vVHRN7zYgcp0n4z5A6HAK7bvKGBiswaM5zIlOQczsxj/aiD7RcgD+dvVFuwFaGh5+kM7XA6Q6PN0bvb1tw==", |
121 | "dev": true, | 121 | "dev": true, |
122 | "requires": { | 122 | "requires": { |
123 | "@typescript-eslint/experimental-utils": "2.26.0", | 123 | "@typescript-eslint/experimental-utils": "2.27.0", |
124 | "functional-red-black-tree": "^1.0.1", | 124 | "functional-red-black-tree": "^1.0.1", |
125 | "regexpp": "^3.0.0", | 125 | "regexpp": "^3.0.0", |
126 | "tsutils": "^3.17.1" | 126 | "tsutils": "^3.17.1" |
127 | } | 127 | } |
128 | }, | 128 | }, |
129 | "@typescript-eslint/experimental-utils": { | 129 | "@typescript-eslint/experimental-utils": { |
130 | "version": "2.26.0", | 130 | "version": "2.27.0", |
131 | "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.26.0.tgz", | 131 | "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.27.0.tgz", |
132 | "integrity": "sha512-RELVoH5EYd+JlGprEyojUv9HeKcZqF7nZUGSblyAw1FwOGNnmQIU8kxJ69fttQvEwCsX5D6ECJT8GTozxrDKVQ==", | 132 | "integrity": "sha512-vOsYzjwJlY6E0NJRXPTeCGqjv5OHgRU1kzxHKWJVPjDYGbPgLudBXjIlc+OD1hDBZ4l1DLbOc5VjofKahsu9Jw==", |
133 | "dev": true, | 133 | "dev": true, |
134 | "requires": { | 134 | "requires": { |
135 | "@types/json-schema": "^7.0.3", | 135 | "@types/json-schema": "^7.0.3", |
136 | "@typescript-eslint/typescript-estree": "2.26.0", | 136 | "@typescript-eslint/typescript-estree": "2.27.0", |
137 | "eslint-scope": "^5.0.0", | 137 | "eslint-scope": "^5.0.0", |
138 | "eslint-utils": "^2.0.0" | 138 | "eslint-utils": "^2.0.0" |
139 | }, | 139 | }, |
@@ -150,21 +150,21 @@ | |||
150 | } | 150 | } |
151 | }, | 151 | }, |
152 | "@typescript-eslint/parser": { | 152 | "@typescript-eslint/parser": { |
153 | "version": "2.26.0", | 153 | "version": "2.27.0", |
154 | "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.26.0.tgz", | 154 | "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.27.0.tgz", |
155 | "integrity": "sha512-+Xj5fucDtdKEVGSh9353wcnseMRkPpEAOY96EEenN7kJVrLqy/EVwtIh3mxcUz8lsFXW1mT5nN5vvEam/a5HiQ==", | 155 | "integrity": "sha512-HFUXZY+EdwrJXZo31DW4IS1ujQW3krzlRjBrFRrJcMDh0zCu107/nRfhk/uBasO8m0NVDbBF5WZKcIUMRO7vPg==", |
156 | "dev": true, | 156 | "dev": true, |
157 | "requires": { | 157 | "requires": { |
158 | "@types/eslint-visitor-keys": "^1.0.0", | 158 | "@types/eslint-visitor-keys": "^1.0.0", |
159 | "@typescript-eslint/experimental-utils": "2.26.0", | 159 | "@typescript-eslint/experimental-utils": "2.27.0", |
160 | "@typescript-eslint/typescript-estree": "2.26.0", | 160 | "@typescript-eslint/typescript-estree": "2.27.0", |
161 | "eslint-visitor-keys": "^1.1.0" | 161 | "eslint-visitor-keys": "^1.1.0" |
162 | } | 162 | } |
163 | }, | 163 | }, |
164 | "@typescript-eslint/typescript-estree": { | 164 | "@typescript-eslint/typescript-estree": { |
165 | "version": "2.26.0", | 165 | "version": "2.27.0", |
166 | "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.26.0.tgz", | 166 | "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.27.0.tgz", |
167 | "integrity": "sha512-3x4SyZCLB4zsKsjuhxDLeVJN6W29VwBnYpCsZ7vIdPel9ZqLfIZJgJXO47MNUkurGpQuIBALdPQKtsSnWpE1Yg==", | 167 | "integrity": "sha512-t2miCCJIb/FU8yArjAvxllxbTiyNqaXJag7UOpB5DVoM3+xnjeOngtqlJkLRnMtzaRcJhe3CIR9RmL40omubhg==", |
168 | "dev": true, | 168 | "dev": true, |
169 | "requires": { | 169 | "requires": { |
170 | "debug": "^4.1.1", | 170 | "debug": "^4.1.1", |
@@ -1367,9 +1367,9 @@ | |||
1367 | } | 1367 | } |
1368 | }, | 1368 | }, |
1369 | "regexpp": { | 1369 | "regexpp": { |
1370 | "version": "3.0.0", | 1370 | "version": "3.1.0", |
1371 | "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", | 1371 | "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz", |
1372 | "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", | 1372 | "integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==", |
1373 | "dev": true | 1373 | "dev": true |
1374 | }, | 1374 | }, |
1375 | "resolve": { | 1375 | "resolve": { |
@@ -1407,9 +1407,9 @@ | |||
1407 | } | 1407 | } |
1408 | }, | 1408 | }, |
1409 | "rollup": { | 1409 | "rollup": { |
1410 | "version": "2.3.2", | 1410 | "version": "2.3.3", |
1411 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.2.tgz", | 1411 | "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.3.3.tgz", |
1412 | "integrity": "sha512-p66+fbfaUUOGE84sHXAOgfeaYQMslgAazoQMp//nlR519R61213EPFgrMZa48j31jNacJwexSAR1Q8V/BwGKBA==", | 1412 | "integrity": "sha512-uJ9VNWk80mb4wDCSfd1AyHoSc9TrWbkZtnO6wbsMTp9muSWkT26Dvc99MX1yGCOTvUN1Skw/KpFzKdUDuZKTXA==", |
1413 | "dev": true, | 1413 | "dev": true, |
1414 | "requires": { | 1414 | "requires": { |
1415 | "fsevents": "~2.1.2" | 1415 | "fsevents": "~2.1.2" |
diff --git a/editors/code/package.json b/editors/code/package.json index 8ae8ea414..0bf7b6ae6 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -21,7 +21,7 @@ | |||
21 | "Programming Languages" | 21 | "Programming Languages" |
22 | ], | 22 | ], |
23 | "engines": { | 23 | "engines": { |
24 | "vscode": "^1.43.0" | 24 | "vscode": "^1.44.0" |
25 | }, | 25 | }, |
26 | "enableProposedApi": true, | 26 | "enableProposedApi": true, |
27 | "scripts": { | 27 | "scripts": { |
@@ -42,10 +42,10 @@ | |||
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.43.0", |
45 | "@typescript-eslint/eslint-plugin": "^2.26.0", | 45 | "@typescript-eslint/eslint-plugin": "^2.27.0", |
46 | "@typescript-eslint/parser": "^2.26.0", | 46 | "@typescript-eslint/parser": "^2.27.0", |
47 | "eslint": "^6.8.0", | 47 | "eslint": "^6.8.0", |
48 | "rollup": "^2.3.2", | 48 | "rollup": "^2.3.3", |
49 | "tslib": "^1.11.1", | 49 | "tslib": "^1.11.1", |
50 | "typescript": "^3.8.3", | 50 | "typescript": "^3.8.3", |
51 | "typescript-formatter": "^7.2.2", | 51 | "typescript-formatter": "^7.2.2", |
@@ -342,11 +342,6 @@ | |||
342 | "default": true, | 342 | "default": true, |
343 | "description": "Show function name and docs in parameter hints" | 343 | "description": "Show function name and docs in parameter hints" |
344 | }, | 344 | }, |
345 | "rust-analyzer.highlighting.semanticTokens": { | ||
346 | "type": "boolean", | ||
347 | "default": false, | ||
348 | "description": "Use proposed semantic tokens API for syntax highlighting" | ||
349 | }, | ||
350 | "rust-analyzer.updates.channel": { | 345 | "rust-analyzer.updates.channel": { |
351 | "type": "string", | 346 | "type": "string", |
352 | "enum": [ | 347 | "enum": [ |
diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 3b1d00bca..0ad4b63ae 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts | |||
@@ -1,11 +1,10 @@ | |||
1 | import * as lc from 'vscode-languageclient'; | 1 | import * as lc from 'vscode-languageclient'; |
2 | import * as vscode from 'vscode'; | 2 | import * as vscode from 'vscode'; |
3 | 3 | ||
4 | import { Config } from './config'; | ||
5 | import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; | 4 | import { CallHierarchyFeature } from 'vscode-languageclient/lib/callHierarchy.proposed'; |
6 | import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; | 5 | import { SemanticTokensFeature, DocumentSemanticsTokensSignature } from 'vscode-languageclient/lib/semanticTokens.proposed'; |
7 | 6 | ||
8 | export async function createClient(config: Config, serverPath: string, cwd: string): Promise<lc.LanguageClient> { | 7 | export async function createClient(serverPath: string, cwd: string): Promise<lc.LanguageClient> { |
9 | // '.' Is the fallback if no folder is open | 8 | // '.' Is the fallback if no folder is open |
10 | // TODO?: Workspace folders support Uri's (eg: file://test.txt). | 9 | // TODO?: Workspace folders support Uri's (eg: file://test.txt). |
11 | // It might be a good idea to test if the uri points to a file. | 10 | // It might be a good idea to test if the uri points to a file. |
@@ -73,15 +72,12 @@ export async function createClient(config: Config, serverPath: string, cwd: stri | |||
73 | }; | 72 | }; |
74 | 73 | ||
75 | // To turn on all proposed features use: res.registerProposedFeatures(); | 74 | // To turn on all proposed features use: res.registerProposedFeatures(); |
76 | // Here we want to just enable CallHierarchyFeature since it is available on stable. | 75 | // Here we want to enable CallHierarchyFeature and SemanticTokensFeature |
77 | // Note that while the CallHierarchyFeature is stable the LSP protocol is not. | 76 | // since they are available on stable. |
77 | // Note that while these features are stable in vscode their LSP protocol | ||
78 | // implementations are still in the "proposed" category for 3.16. | ||
78 | res.registerFeature(new CallHierarchyFeature(res)); | 79 | res.registerFeature(new CallHierarchyFeature(res)); |
79 | 80 | res.registerFeature(new SemanticTokensFeature(res)); | |
80 | if (config.package.enableProposedApi) { | ||
81 | if (config.highlightingSemanticTokens) { | ||
82 | res.registerFeature(new SemanticTokensFeature(res)); | ||
83 | } | ||
84 | } | ||
85 | 81 | ||
86 | return res; | 82 | return res; |
87 | } | 83 | } |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 1f45f1de0..21c1c9f23 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -69,7 +69,6 @@ export class Config { | |||
69 | get serverPath() { return this.cfg.get<null | string>("serverPath")!; } | 69 | get serverPath() { return this.cfg.get<null | string>("serverPath")!; } |
70 | get channel() { return this.cfg.get<UpdatesChannel>("updates.channel")!; } | 70 | get channel() { return this.cfg.get<UpdatesChannel>("updates.channel")!; } |
71 | get askBeforeDownload() { return this.cfg.get<boolean>("updates.askBeforeDownload")!; } | 71 | get askBeforeDownload() { return this.cfg.get<boolean>("updates.askBeforeDownload")!; } |
72 | get highlightingSemanticTokens() { return this.cfg.get<boolean>("highlighting.semanticTokens")!; } | ||
73 | get traceExtension() { return this.cfg.get<boolean>("trace.extension")!; } | 72 | get traceExtension() { return this.cfg.get<boolean>("trace.extension")!; } |
74 | 73 | ||
75 | get inlayHints() { | 74 | get inlayHints() { |
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index bd1c3de07..f7ed62d03 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts | |||
@@ -21,7 +21,7 @@ export class Ctx { | |||
21 | serverPath: string, | 21 | serverPath: string, |
22 | cwd: string, | 22 | cwd: string, |
23 | ): Promise<Ctx> { | 23 | ): Promise<Ctx> { |
24 | const client = await createClient(config, serverPath, cwd); | 24 | const client = await createClient(serverPath, cwd); |
25 | const res = new Ctx(config, extCtx, client, serverPath); | 25 | const res = new Ctx(config, extCtx, client, serverPath); |
26 | res.pushCleanup(client.start()); | 26 | res.pushCleanup(client.start()); |
27 | await client.onReady(); | 27 | await client.onReady(); |