aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/config.ts
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-04-02 11:10:26 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-04-02 11:10:26 +0100
commitbb3b159fb7d377f667732ade715cbe019da84d71 (patch)
tree2cfb500a2eec37f1689ec9448babbbfedc28fba0 /editors/code/src/config.ts
parentb0d244719323d68905986857844f56d1fa38cac4 (diff)
parentb60e2f779b28f654dbd5a2657c668de8452933c6 (diff)
Merge #1079
1079: Improve cargo-watch usage in vscode plugin r=matklad a=edwin0cheng *This PR try to improve current cargo-watch usage in VSCode :* 1. Add Multi-lines error support : ![multilines-error](https://i.imgur.com/gbLEwMG.gif) 2. Add cargo-watch status animation : ![cargo-watch-status](https://i.imgur.com/GbHwzjj.gif) *Implementation Details* * Current VSCode `ProblemMatcher` still do not support multiple line parsing. * However we can, spawn a cargo watch process instead of using vscode.Task to allow more control. * Use `cargo-check --message-format json` to get json format of compiler-message. * Use `vscode.DiagnosticCollection` to manage the problems directly, which allow multiple lines diagnostic. However, * VSCode use non mono-space font for problems, at this moment i cannot find a good solution about it. * I am not so good in typescript, please let me know if anything is bad in this PR. Co-authored-by: Edwin Cheng <[email protected]> Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'editors/code/src/config.ts')
-rw-r--r--editors/code/src/config.ts34
1 files changed, 29 insertions, 5 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 420589068..481a5e5f1 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -4,14 +4,25 @@ import { Server } from './server';
4 4
5const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; 5const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
6 6
7export type CargoWatchOptions = 'ask' | 'enabled' | 'disabled'; 7export type CargoWatchStartupOptions = 'ask' | 'enabled' | 'disabled';
8export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose';
9
10export interface CargoWatchOptions {
11 enableOnStartup: CargoWatchStartupOptions;
12 checkArguments: string;
13 trace: CargoWatchTraceOptions;
14}
8 15
9export class Config { 16export class Config {
10 public highlightingOn = true; 17 public highlightingOn = true;
11 public enableEnhancedTyping = true; 18 public enableEnhancedTyping = true;
12 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server'; 19 public raLspServerPath = RA_LSP_DEBUG || 'ra_lsp_server';
13 public showWorkspaceLoadedNotification = true; 20 public showWorkspaceLoadedNotification = true;
14 public enableCargoWatchOnStartup: CargoWatchOptions = 'ask'; 21 public cargoWatchOptions: CargoWatchOptions = {
22 enableOnStartup: 'ask',
23 trace: 'off',
24 checkArguments: ''
25 };
15 26
16 private prevEnhancedTyping: null | boolean = null; 27 private prevEnhancedTyping: null | boolean = null;
17 28
@@ -73,9 +84,22 @@ export class Config {
73 } 84 }
74 85
75 if (config.has('enableCargoWatchOnStartup')) { 86 if (config.has('enableCargoWatchOnStartup')) {
76 this.enableCargoWatchOnStartup = config.get<CargoWatchOptions>( 87 this.cargoWatchOptions.enableOnStartup = config.get<
77 'enableCargoWatchOnStartup', 88 CargoWatchStartupOptions
78 'ask' 89 >('enableCargoWatchOnStartup', 'ask');
90 }
91
92 if (config.has('trace.cargo-watch')) {
93 this.cargoWatchOptions.trace = config.get<CargoWatchTraceOptions>(
94 'trace.cargo-watch',
95 'off'
96 );
97 }
98
99 if (config.has('cargo-watch.check-arguments')) {
100 this.cargoWatchOptions.checkArguments = config.get<string>(
101 'cargo-watch.check-arguments',
102 ''
79 ); 103 );
80 } 104 }
81 } 105 }