diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/code/package.json | 94 | ||||
-rw-r--r-- | editors/code/src/commands/cargo_watch.ts | 6 | ||||
-rw-r--r-- | editors/code/src/config.ts | 13 | ||||
-rw-r--r-- | editors/code/src/highlighting.ts | 7 | ||||
-rw-r--r-- | editors/code/src/notifications/publish_decorations.ts | 11 |
5 files changed, 122 insertions, 9 deletions
diff --git a/editors/code/package.json b/editors/code/package.json index e3bb07be7..f7ab2c2f3 100644 --- a/editors/code/package.json +++ b/editors/code/package.json | |||
@@ -219,7 +219,7 @@ | |||
219 | }, | 219 | }, |
220 | "rust-analyzer.useClientWatching": { | 220 | "rust-analyzer.useClientWatching": { |
221 | "type": "boolean", | 221 | "type": "boolean", |
222 | "default": false, | 222 | "default": true, |
223 | "description": "client provided file watching instead of notify watching." | 223 | "description": "client provided file watching instead of notify watching." |
224 | }, | 224 | }, |
225 | "rust-analyzer.cargo-watch.arguments": { | 225 | "rust-analyzer.cargo-watch.arguments": { |
@@ -237,6 +237,11 @@ | |||
237 | "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", | 237 | "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", |
238 | "default": [] | 238 | "default": [] |
239 | }, | 239 | }, |
240 | "rust-analyzer.cargo-watch.allTargets": { | ||
241 | "type": "boolean", | ||
242 | "description": "Check all targets and tests (will be passed as `--all-targets`)", | ||
243 | "default": true | ||
244 | }, | ||
240 | "rust-analyzer.trace.server": { | 245 | "rust-analyzer.trace.server": { |
241 | "type": "string", | 246 | "type": "string", |
242 | "scope": "window", | 247 | "scope": "window", |
@@ -313,6 +318,20 @@ | |||
313 | "column": 3 | 318 | "column": 3 |
314 | } | 319 | } |
315 | ] | 320 | ] |
321 | }, | ||
322 | { | ||
323 | "name": "rustc-json", | ||
324 | "patterns": [ | ||
325 | { | ||
326 | "regexp": "^.*\"message\":{\"message\":\"([^\"]*).*?\"file_name\":\"([^\"]+).*?\"line_start\":(\\d+).*?\"line_end\":(\\d+).*?\"column_start\":(\\d+).*?\"column_end\":(\\d+).*}$", | ||
327 | "message": 1, | ||
328 | "file": 2, | ||
329 | "line": 3, | ||
330 | "endLine": 4, | ||
331 | "column": 5, | ||
332 | "endColumn": 6 | ||
333 | } | ||
334 | ] | ||
316 | } | 335 | } |
317 | ], | 336 | ], |
318 | "problemMatchers": [ | 337 | "problemMatchers": [ |
@@ -325,6 +344,14 @@ | |||
325 | "pattern": "$rustc" | 344 | "pattern": "$rustc" |
326 | }, | 345 | }, |
327 | { | 346 | { |
347 | "name": "rustc-json", | ||
348 | "fileLocation": [ | ||
349 | "relative", | ||
350 | "${workspaceRoot}" | ||
351 | ], | ||
352 | "pattern": "$rustc-json" | ||
353 | }, | ||
354 | { | ||
328 | "name": "rustc-watch", | 355 | "name": "rustc-watch", |
329 | "fileLocation": [ | 356 | "fileLocation": [ |
330 | "relative", | 357 | "relative", |
@@ -438,6 +465,33 @@ | |||
438 | } | 465 | } |
439 | }, | 466 | }, |
440 | { | 467 | { |
468 | "id": "ralsp.literal.numeric", | ||
469 | "description": "Color for numeric literals", | ||
470 | "defaults": { | ||
471 | "dark": "#BECEA8", | ||
472 | "light": "#09885A", | ||
473 | "highContrast": "#B5CEA8" | ||
474 | } | ||
475 | }, | ||
476 | { | ||
477 | "id": "ralsp.literal.char", | ||
478 | "description": "Color for character literals", | ||
479 | "defaults": { | ||
480 | "dark": "#BECEA8", | ||
481 | "light": "#09885A", | ||
482 | "highContrast": "#B5CEA8" | ||
483 | } | ||
484 | }, | ||
485 | { | ||
486 | "id": "ralsp.literal.byte", | ||
487 | "description": "Color for byte literals", | ||
488 | "defaults": { | ||
489 | "dark": "#BECEA8", | ||
490 | "light": "#09885A", | ||
491 | "highContrast": "#B5CEA8" | ||
492 | } | ||
493 | }, | ||
494 | { | ||
441 | "id": "ralsp.macro", | 495 | "id": "ralsp.macro", |
442 | "description": "Color for macros", | 496 | "description": "Color for macros", |
443 | "defaults": { | 497 | "defaults": { |
@@ -457,7 +511,43 @@ | |||
457 | }, | 511 | }, |
458 | { | 512 | { |
459 | "id": "ralsp.type", | 513 | "id": "ralsp.type", |
460 | "description": "Color for types", | 514 | "description": "Color for other types (traits, aliases..)", |
515 | "defaults": { | ||
516 | "dark": "#4EC9B0", | ||
517 | "light": "#267F99", | ||
518 | "highContrast": "#4EC9B0" | ||
519 | } | ||
520 | }, | ||
521 | { | ||
522 | "id": "ralsp.type.builtin", | ||
523 | "description": "Color for built-in types (&str, bool, u16, u32)", | ||
524 | "defaults": { | ||
525 | "dark": "#4EC9B0", | ||
526 | "light": "#267F99", | ||
527 | "highContrast": "#4EC9B0" | ||
528 | } | ||
529 | }, | ||
530 | { | ||
531 | "id": "ralsp.type.lifetime", | ||
532 | "description": "Color for lifetimes parameters", | ||
533 | "defaults": { | ||
534 | "dark": "#4EC9B0", | ||
535 | "light": "#267F99", | ||
536 | "highContrast": "#4EC9B0" | ||
537 | } | ||
538 | }, | ||
539 | { | ||
540 | "id": "ralsp.type.self", | ||
541 | "description": "Color for `Self` param type", | ||
542 | "defaults": { | ||
543 | "dark": "#4EC9B0", | ||
544 | "light": "#267F99", | ||
545 | "highContrast": "#4EC9B0" | ||
546 | } | ||
547 | }, | ||
548 | { | ||
549 | "id": "ralsp.type.param", | ||
550 | "description": "Color for type parameters", | ||
461 | "defaults": { | 551 | "defaults": { |
462 | "dark": "#4EC9B0", | 552 | "dark": "#4EC9B0", |
463 | "light": "#267F99", | 553 | "light": "#267F99", |
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts index 512362eb1..748be535c 100644 --- a/editors/code/src/commands/cargo_watch.ts +++ b/editors/code/src/commands/cargo_watch.ts | |||
@@ -82,8 +82,10 @@ export class CargoWatchProvider implements vscode.Disposable { | |||
82 | } | 82 | } |
83 | 83 | ||
84 | let args = | 84 | let args = |
85 | Server.config.cargoWatchOptions.command + | 85 | Server.config.cargoWatchOptions.command + ' --message-format json'; |
86 | ' --all-targets --message-format json'; | 86 | if (Server.config.cargoWatchOptions.allTargets) { |
87 | args += ' --all-targets'; | ||
88 | } | ||
87 | if (Server.config.cargoWatchOptions.command.length > 0) { | 89 | if (Server.config.cargoWatchOptions.command.length > 0) { |
88 | // Excape the double quote string: | 90 | // Excape the double quote string: |
89 | args += ' ' + Server.config.cargoWatchOptions.arguments; | 91 | args += ' ' + Server.config.cargoWatchOptions.arguments; |
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index defdfeb9c..e131f09df 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -13,6 +13,7 @@ export interface CargoWatchOptions { | |||
13 | command: string; | 13 | command: string; |
14 | trace: CargoWatchTraceOptions; | 14 | trace: CargoWatchTraceOptions; |
15 | ignore: string[]; | 15 | ignore: string[]; |
16 | allTargets: boolean; | ||
16 | } | 17 | } |
17 | 18 | ||
18 | export interface CargoFeatures { | 19 | export interface CargoFeatures { |
@@ -30,7 +31,7 @@ export class Config { | |||
30 | public displayInlayHints = true; | 31 | public displayInlayHints = true; |
31 | public maxInlayHintLength: null | number = null; | 32 | public maxInlayHintLength: null | number = null; |
32 | public excludeGlobs = []; | 33 | public excludeGlobs = []; |
33 | public useClientWatching = false; | 34 | public useClientWatching = true; |
34 | public featureFlags = {}; | 35 | public featureFlags = {}; |
35 | // for internal use | 36 | // for internal use |
36 | public withSysroot: null | boolean = null; | 37 | public withSysroot: null | boolean = null; |
@@ -40,6 +41,7 @@ export class Config { | |||
40 | arguments: '', | 41 | arguments: '', |
41 | command: '', | 42 | command: '', |
42 | ignore: [], | 43 | ignore: [], |
44 | allTargets: true, | ||
43 | }; | 45 | }; |
44 | public cargoFeatures: CargoFeatures = { | 46 | public cargoFeatures: CargoFeatures = { |
45 | noDefaultFeatures: false, | 47 | noDefaultFeatures: false, |
@@ -132,6 +134,13 @@ export class Config { | |||
132 | ); | 134 | ); |
133 | } | 135 | } |
134 | 136 | ||
137 | if (config.has('cargo-watch.allTargets')) { | ||
138 | this.cargoWatchOptions.allTargets = config.get<boolean>( | ||
139 | 'cargo-watch.allTargets', | ||
140 | true, | ||
141 | ); | ||
142 | } | ||
143 | |||
135 | if (config.has('lruCapacity')) { | 144 | if (config.has('lruCapacity')) { |
136 | this.lruCapacity = config.get('lruCapacity') as number; | 145 | this.lruCapacity = config.get('lruCapacity') as number; |
137 | } | 146 | } |
@@ -148,7 +157,7 @@ export class Config { | |||
148 | this.excludeGlobs = config.get('excludeGlobs') || []; | 157 | this.excludeGlobs = config.get('excludeGlobs') || []; |
149 | } | 158 | } |
150 | if (config.has('useClientWatching')) { | 159 | if (config.has('useClientWatching')) { |
151 | this.useClientWatching = config.get('useClientWatching') || false; | 160 | this.useClientWatching = config.get('useClientWatching') || true; |
152 | } | 161 | } |
153 | if (config.has('featureFlags')) { | 162 | if (config.has('featureFlags')) { |
154 | this.featureFlags = config.get('featureFlags') || {}; | 163 | this.featureFlags = config.get('featureFlags') || {}; |
diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index 6d50a2f2d..d7c0ae131 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts | |||
@@ -53,10 +53,17 @@ export class Highlighter { | |||
53 | decoration('parameter'), | 53 | decoration('parameter'), |
54 | decoration('constant'), | 54 | decoration('constant'), |
55 | decoration('type'), | 55 | decoration('type'), |
56 | decoration('type.self'), | ||
57 | decoration('type.generic'), | ||
58 | decoration('type.param'), | ||
59 | decoration('type.lifetime'), | ||
56 | decoration('builtin'), | 60 | decoration('builtin'), |
57 | decoration('text'), | 61 | decoration('text'), |
58 | decoration('attribute'), | 62 | decoration('attribute'), |
59 | decoration('literal'), | 63 | decoration('literal'), |
64 | decoration('literal.numeric'), | ||
65 | decoration('literal.char'), | ||
66 | decoration('literal.byte'), | ||
60 | decoration('macro'), | 67 | decoration('macro'), |
61 | decoration('variable'), | 68 | decoration('variable'), |
62 | decoration('variable.mut', 'underline'), | 69 | decoration('variable.mut', 'underline'), |
diff --git a/editors/code/src/notifications/publish_decorations.ts b/editors/code/src/notifications/publish_decorations.ts index 00ffb7776..f23e286ad 100644 --- a/editors/code/src/notifications/publish_decorations.ts +++ b/editors/code/src/notifications/publish_decorations.ts | |||
@@ -9,11 +9,16 @@ export interface PublishDecorationsParams { | |||
9 | } | 9 | } |
10 | 10 | ||
11 | export function handle(params: PublishDecorationsParams) { | 11 | export function handle(params: PublishDecorationsParams) { |
12 | const targetEditor = vscode.window.visibleTextEditors.find( | 12 | const targetEditor = vscode.window.visibleTextEditors.find(editor => { |
13 | editor => editor.document.uri.toString() === params.uri, | 13 | const unescapedUri = unescape(editor.document.uri.toString()); |
14 | ); | 14 | // Unescaped URI looks like: |
15 | // file:///c:/Workspace/ra-test/src/main.rs | ||
16 | return unescapedUri === params.uri; | ||
17 | }); | ||
18 | |||
15 | if (!Server.config.highlightingOn || !targetEditor) { | 19 | if (!Server.config.highlightingOn || !targetEditor) { |
16 | return; | 20 | return; |
17 | } | 21 | } |
22 | |||
18 | Server.highlighter.setHighlights(targetEditor, params.decorations); | 23 | Server.highlighter.setHighlights(targetEditor, params.decorations); |
19 | } | 24 | } |