diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-29 12:57:24 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-29 12:57:24 +0000 |
commit | dc48f89581843248660ceb755bb20469ab6ac0c9 (patch) | |
tree | 05a7e47d1c68c250025be1ce6492f56c15353749 /editors/code/src/config.ts | |
parent | cdcb3d3833d3d5b37b2cd4dac91a6e9366f20aea (diff) | |
parent | 899dbebd02b41b12d89c9f485e85208b39b81932 (diff) |
Merge #2668
2668: In-server cargo check watching r=matklad a=kiljacken
Opening a draft now so people can follow the progress, and comment if they spot something stupid.
Things that need doing:
- [x] Running cargo check on save
- [x] Pipe through configuration options from client
- [x] Tests for parsing behavior
- [x] Remove existing cargo watch support from VSCode extension
- [x] Progress notification in VSCode extension using LSP 3.15 `$/progress` notification
- [ ] ~~Rework ra-ide diagnostics to support secondary messages~~
- [ ] ~~Make cargo-check watcher use ra-ide diagnostics~~
~~I'd love some input on whether to try to keep the status bar progress thingy for VSCode? It will require some plumbing, and maintaining yet another rust-analyzer specific LSP notification, which I'm not sure we want to.~~
Fixes #1894
Co-authored-by: Emil Lauridsen <[email protected]>
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r-- | editors/code/src/config.ts | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index e131f09df..4b388b80c 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -4,15 +4,10 @@ import { Server } from './server'; | |||
4 | 4 | ||
5 | const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; | 5 | const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; |
6 | 6 | ||
7 | export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled'; | ||
8 | export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose'; | ||
9 | |||
10 | export interface CargoWatchOptions { | 7 | export interface CargoWatchOptions { |
11 | enableOnStartup: CargoWatchStartupOptions; | 8 | enable: boolean; |
12 | arguments: string; | 9 | arguments: string[]; |
13 | command: string; | 10 | command: string; |
14 | trace: CargoWatchTraceOptions; | ||
15 | ignore: string[]; | ||
16 | allTargets: boolean; | 11 | allTargets: boolean; |
17 | } | 12 | } |
18 | 13 | ||
@@ -36,11 +31,9 @@ export class Config { | |||
36 | // for internal use | 31 | // for internal use |
37 | public withSysroot: null | boolean = null; | 32 | public withSysroot: null | boolean = null; |
38 | public cargoWatchOptions: CargoWatchOptions = { | 33 | public cargoWatchOptions: CargoWatchOptions = { |
39 | enableOnStartup: 'ask', | 34 | enable: true, |
40 | trace: 'off', | 35 | arguments: [], |
41 | arguments: '', | ||
42 | command: '', | 36 | command: '', |
43 | ignore: [], | ||
44 | allTargets: true, | 37 | allTargets: true, |
45 | }; | 38 | }; |
46 | public cargoFeatures: CargoFeatures = { | 39 | public cargoFeatures: CargoFeatures = { |
@@ -100,23 +93,17 @@ export class Config { | |||
100 | RA_LSP_DEBUG || (config.get('raLspServerPath') as string); | 93 | RA_LSP_DEBUG || (config.get('raLspServerPath') as string); |
101 | } | 94 | } |
102 | 95 | ||
103 | if (config.has('enableCargoWatchOnStartup')) { | 96 | if (config.has('cargo-watch.enable')) { |
104 | this.cargoWatchOptions.enableOnStartup = config.get< | 97 | this.cargoWatchOptions.enable = config.get<boolean>( |
105 | CargoWatchStartupOptions | 98 | 'cargo-watch.enable', |
106 | >('enableCargoWatchOnStartup', 'ask'); | 99 | true, |
107 | } | ||
108 | |||
109 | if (config.has('trace.cargo-watch')) { | ||
110 | this.cargoWatchOptions.trace = config.get<CargoWatchTraceOptions>( | ||
111 | 'trace.cargo-watch', | ||
112 | 'off', | ||
113 | ); | 100 | ); |
114 | } | 101 | } |
115 | 102 | ||
116 | if (config.has('cargo-watch.arguments')) { | 103 | if (config.has('cargo-watch.arguments')) { |
117 | this.cargoWatchOptions.arguments = config.get<string>( | 104 | this.cargoWatchOptions.arguments = config.get<string[]>( |
118 | 'cargo-watch.arguments', | 105 | 'cargo-watch.arguments', |
119 | '', | 106 | [], |
120 | ); | 107 | ); |
121 | } | 108 | } |
122 | 109 | ||
@@ -127,13 +114,6 @@ export class Config { | |||
127 | ); | 114 | ); |
128 | } | 115 | } |
129 | 116 | ||
130 | if (config.has('cargo-watch.ignore')) { | ||
131 | this.cargoWatchOptions.ignore = config.get<string[]>( | ||
132 | 'cargo-watch.ignore', | ||
133 | [], | ||
134 | ); | ||
135 | } | ||
136 | |||
137 | if (config.has('cargo-watch.allTargets')) { | 117 | if (config.has('cargo-watch.allTargets')) { |
138 | this.cargoWatchOptions.allTargets = config.get<boolean>( | 118 | this.cargoWatchOptions.allTargets = config.get<boolean>( |
139 | 'cargo-watch.allTargets', | 119 | 'cargo-watch.allTargets', |