From 7ac4ea7fec018f76eed5b5c10fc96ba3d9b969be Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 9 Dec 2019 18:05:49 +0100 Subject: Allow disabling sysroot Might be helpful for debugging --- editors/code/src/config.ts | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'editors/code/src/config.ts') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 95c3f42e5..fb9e55dd6 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -26,6 +26,8 @@ export class Config { public excludeGlobs = []; public useClientWatching = false; public featureFlags = {}; + // for internal use + public withSysroot: null | boolean = null; public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', @@ -148,5 +150,8 @@ export class Config { if (config.has('featureFlags')) { this.featureFlags = config.get('featureFlags') || {}; } + if (config.has('withSysroot')) { + this.withSysroot = config.get('withSysroot') || false; + } } } -- cgit v1.2.3 From 273299693b85996878907ad256ed55f072ec3f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 9 Dec 2019 20:57:55 +0200 Subject: Code: enable prettier trailing commas --- editors/code/src/config.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'editors/code/src/config.ts') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index fb9e55dd6..2d3b6a54e 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -33,14 +33,14 @@ export class Config { trace: 'off', arguments: '', command: '', - ignore: [] + ignore: [], }; private prevEnhancedTyping: null | boolean = null; constructor() { vscode.workspace.onDidChangeConfiguration(_ => - this.userConfigChanged() + this.userConfigChanged(), ); this.userConfigChanged(); } @@ -53,7 +53,7 @@ export class Config { if (config.has('rainbowHighlightingOn')) { this.rainbowHighlightingOn = config.get( - 'rainbowHighlightingOn' + 'rainbowHighlightingOn', ) as boolean; } @@ -63,7 +63,7 @@ export class Config { if (config.has('enableEnhancedTyping')) { this.enableEnhancedTyping = config.get( - 'enableEnhancedTyping' + 'enableEnhancedTyping', ) as boolean; if (this.prevEnhancedTyping === null) { @@ -78,12 +78,12 @@ export class Config { vscode.window .showInformationMessage( 'Changing enhanced typing setting requires a reload', - reloadAction + reloadAction, ) .then(selectedAction => { if (selectedAction === reloadAction) { vscode.commands.executeCommand( - 'workbench.action.reloadWindow' + 'workbench.action.reloadWindow', ); } }); @@ -104,28 +104,28 @@ export class Config { if (config.has('trace.cargo-watch')) { this.cargoWatchOptions.trace = config.get( 'trace.cargo-watch', - 'off' + 'off', ); } if (config.has('cargo-watch.arguments')) { this.cargoWatchOptions.arguments = config.get( 'cargo-watch.arguments', - '' + '', ); } if (config.has('cargo-watch.command')) { this.cargoWatchOptions.command = config.get( 'cargo-watch.command', - '' + '', ); } if (config.has('cargo-watch.ignore')) { this.cargoWatchOptions.ignore = config.get( 'cargo-watch.ignore', - [] + [], ); } @@ -138,7 +138,7 @@ export class Config { } if (config.has('maxInlayHintLength')) { this.maxInlayHintLength = config.get( - 'maxInlayHintLength' + 'maxInlayHintLength', ) as number; } if (config.has('excludeGlobs')) { -- cgit v1.2.3 From af4eb266457eb784010da28d80535f9fd38d4d1e Mon Sep 17 00:00:00 2001 From: oxalica Date: Fri, 13 Dec 2019 18:16:34 +0800 Subject: Support setting cargo features --- editors/code/src/config.ts | 70 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 13 deletions(-) (limited to 'editors/code/src/config.ts') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 2d3b6a54e..6d709f7a8 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -15,6 +15,12 @@ export interface CargoWatchOptions { ignore: string[]; } +export interface CargoFeatures { + noDefaultFeatures: boolean; + allFeatures: boolean; + features: string[]; +} + export class Config { public highlightingOn = true; public rainbowHighlightingOn = false; @@ -35,8 +41,14 @@ export class Config { command: '', ignore: [], }; + public cargoFeatures: CargoFeatures = { + noDefaultFeatures: false, + allFeatures: false, + features: [], + }; private prevEnhancedTyping: null | boolean = null; + private prevCargoFeatures: null | CargoFeatures = null; constructor() { vscode.workspace.onDidChangeConfiguration(_ => @@ -47,6 +59,8 @@ export class Config { public userConfigChanged() { const config = vscode.workspace.getConfiguration('rust-analyzer'); + let requireReloadMessage = null; + if (config.has('highlightingOn')) { this.highlightingOn = config.get('highlightingOn') as boolean; } @@ -74,19 +88,7 @@ export class Config { } if (this.prevEnhancedTyping !== this.enableEnhancedTyping) { - const reloadAction = 'Reload now'; - vscode.window - .showInformationMessage( - 'Changing enhanced typing setting requires a reload', - reloadAction, - ) - .then(selectedAction => { - if (selectedAction === reloadAction) { - vscode.commands.executeCommand( - 'workbench.action.reloadWindow', - ); - } - }); + requireReloadMessage = 'Changing enhanced typing setting requires a reload'; this.prevEnhancedTyping = this.enableEnhancedTyping; } @@ -153,5 +155,47 @@ export class Config { if (config.has('withSysroot')) { this.withSysroot = config.get('withSysroot') || false; } + + if (config.has('cargoFeatures.noDefaultFeatures')) { + this.cargoFeatures.noDefaultFeatures = config.get( + 'cargoFeatures.noDefaultFeatures', + false, + ); + } + if (config.has('cargoFeatures.allFeatures')) { + this.cargoFeatures.allFeatures = config.get( + 'cargoFeatures.allFeatures', + false, + ); + } + if (config.has('cargoFeatures.features')) { + this.cargoFeatures.features = config.get( + 'cargoFeatures.features', + [], + ); + } + + if (this.prevCargoFeatures !== null && ( + this.cargoFeatures.allFeatures !== this.prevCargoFeatures.allFeatures || + this.cargoFeatures.noDefaultFeatures !== this.prevCargoFeatures.noDefaultFeatures || + this.cargoFeatures.features.length !== this.prevCargoFeatures.features.length || + this.cargoFeatures.features.some((v, i) => v !== this.prevCargoFeatures!.features[i]) + )) { + requireReloadMessage = 'Changing cargo features requires a reload'; + } + this.prevCargoFeatures = { ...this.cargoFeatures }; + + if (requireReloadMessage !== null) { + const reloadAction = 'Reload now'; + vscode.window + .showInformationMessage(requireReloadMessage, reloadAction) + .then(selectedAction => { + if (selectedAction === reloadAction) { + vscode.commands.executeCommand( + 'workbench.action.reloadWindow', + ); + } + }); + } } } -- cgit v1.2.3 From f56a2a079069edafd74ef92b7e545f18be88b243 Mon Sep 17 00:00:00 2001 From: oxalica Date: Sat, 14 Dec 2019 00:48:47 +0800 Subject: Enable `allFeatures` by default and fix lints --- editors/code/src/config.ts | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'editors/code/src/config.ts') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 6d709f7a8..defdfeb9c 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -43,7 +43,7 @@ export class Config { }; public cargoFeatures: CargoFeatures = { noDefaultFeatures: false, - allFeatures: false, + allFeatures: true, features: [], }; @@ -88,7 +88,8 @@ export class Config { } if (this.prevEnhancedTyping !== this.enableEnhancedTyping) { - requireReloadMessage = 'Changing enhanced typing setting requires a reload'; + requireReloadMessage = + 'Changing enhanced typing setting requires a reload'; this.prevEnhancedTyping = this.enableEnhancedTyping; } @@ -165,7 +166,7 @@ export class Config { if (config.has('cargoFeatures.allFeatures')) { this.cargoFeatures.allFeatures = config.get( 'cargoFeatures.allFeatures', - false, + true, ); } if (config.has('cargoFeatures.features')) { @@ -175,12 +176,18 @@ export class Config { ); } - if (this.prevCargoFeatures !== null && ( - this.cargoFeatures.allFeatures !== this.prevCargoFeatures.allFeatures || - this.cargoFeatures.noDefaultFeatures !== this.prevCargoFeatures.noDefaultFeatures || - this.cargoFeatures.features.length !== this.prevCargoFeatures.features.length || - this.cargoFeatures.features.some((v, i) => v !== this.prevCargoFeatures!.features[i]) - )) { + if ( + this.prevCargoFeatures !== null && + (this.cargoFeatures.allFeatures !== + this.prevCargoFeatures.allFeatures || + this.cargoFeatures.noDefaultFeatures !== + this.prevCargoFeatures.noDefaultFeatures || + this.cargoFeatures.features.length !== + this.prevCargoFeatures.features.length || + this.cargoFeatures.features.some( + (v, i) => v !== this.prevCargoFeatures!.features[i], + )) + ) { requireReloadMessage = 'Changing cargo features requires a reload'; } this.prevCargoFeatures = { ...this.cargoFeatures }; -- cgit v1.2.3 From a85cd6455a66ca75ba9991d91acf36f55cb74e8c Mon Sep 17 00:00:00 2001 From: Vadzim Dambrouski Date: Sun, 15 Dec 2019 23:02:13 +0530 Subject: Add option to disable all-targets. Can be useful in embedded. --- editors/code/src/config.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'editors/code/src/config.ts') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index defdfeb9c..a6e0f6454 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -13,6 +13,7 @@ export interface CargoWatchOptions { command: string; trace: CargoWatchTraceOptions; ignore: string[]; + allTargets: boolean; } export interface CargoFeatures { @@ -40,6 +41,7 @@ export class Config { arguments: '', command: '', ignore: [], + allTargets: true, }; public cargoFeatures: CargoFeatures = { noDefaultFeatures: false, @@ -132,6 +134,13 @@ export class Config { ); } + if (config.has('cargo-watch.allTargets')) { + this.cargoWatchOptions.allTargets = config.get( + 'cargo-watch.allTargets', + true, + ); + } + if (config.has('lruCapacity')) { this.lruCapacity = config.get('lruCapacity') as number; } -- cgit v1.2.3 From 2432f278cb97701e1ca3750bc691ca9bd757892f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 17 Dec 2019 12:41:44 +0100 Subject: Default to client watching on VS Code --- editors/code/src/config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'editors/code/src/config.ts') diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index defdfeb9c..df15c8172 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -30,7 +30,7 @@ export class Config { public displayInlayHints = true; public maxInlayHintLength: null | number = null; public excludeGlobs = []; - public useClientWatching = false; + public useClientWatching = true; public featureFlags = {}; // for internal use public withSysroot: null | boolean = null; @@ -148,7 +148,7 @@ export class Config { this.excludeGlobs = config.get('excludeGlobs') || []; } if (config.has('useClientWatching')) { - this.useClientWatching = config.get('useClientWatching') || false; + this.useClientWatching = config.get('useClientWatching') || true; } if (config.has('featureFlags')) { this.featureFlags = config.get('featureFlags') || {}; -- cgit v1.2.3