Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Commit 9e41eda

Browse files
committed
Always assume multi-project mode and migrate users respectively
1 parent 79968e6 commit 9e41eda

File tree

4 files changed

+32
-27
lines changed

4 files changed

+32
-27
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### Unreleased
22

3+
* Ignore setting `rust-client.enableMultiProjectSetup` (it's always on by default)
34
* Fix support for multiple VSCode workspaces
45

56
### 0.7.2 - 2020-04-17

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@
233233
"description": "If one root workspace folder is nested in another root folder, look for the Rust config in the outermost root."
234234
},
235235
"rust-client.enableMultiProjectSetup": {
236-
"type": "boolean",
237-
"default": false,
236+
"type": ["boolean", "null"],
237+
"default": null,
238238
"description": "Allow multiple projects in the same folder, along with removing the constraint that the cargo.toml must be located at the root. (Experimental: might not work for certain setups)"
239239
},
240240
"rust.sysroot": {

src/configuration.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ export class RLSConfiguration {
118118
return this.configuration.get<string>('rust-client.rlsPath');
119119
}
120120

121-
public get multiProjectEnabled(): boolean {
122-
return this.configuration.get<boolean>(
123-
'rust-client.enableMultiProjectSetup',
124-
false,
125-
);
126-
}
127-
128121
// Added ignoreChannel for readChannel function. Otherwise we end in an infinite loop.
129122
public rustupConfig(ignoreChannel: boolean = false): RustupConfig {
130123
return {

src/extension.ts

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as fs from 'fs';
33
import * as path from 'path';
44
import {
55
commands,
6+
ConfigurationTarget,
67
Disposable,
78
ExtensionContext,
89
IndentAction,
@@ -58,6 +59,33 @@ export async function activate(context: ExtensionContext) {
5859
// Installed listeners don't fire immediately for already opened files, so
5960
// trigger an open event manually to fire up RLS instances where needed
6061
workspace.textDocuments.forEach(whenOpeningTextDocument);
62+
63+
// Migrate the users of multi-project setup for RLS to disable the setting
64+
// entirely (it's always on now)
65+
const config = workspace.getConfiguration();
66+
if (
67+
typeof config.get<boolean | null>(
68+
'rust-client.enableMultiProjectSetup',
69+
null,
70+
) === 'boolean'
71+
) {
72+
window
73+
.showWarningMessage(
74+
'The multi-project setup for RLS is always enabled, so the `rust-client.enableMultiProjectSetup` setting is now redundant',
75+
{ modal: false },
76+
{ title: 'Remove' },
77+
)
78+
.then(value => {
79+
if (value && value.title === 'Remove') {
80+
return config.update(
81+
'rust-client.enableMultiProjectSetup',
82+
null,
83+
ConfigurationTarget.Global,
84+
);
85+
}
86+
return;
87+
});
88+
}
6189
}
6290

6391
export async function deactivate() {
@@ -76,10 +104,7 @@ function whenOpeningTextDocument(document: TextDocument) {
76104
return;
77105
}
78106

79-
const inMultiProjectMode = workspace
80-
.getConfiguration()
81-
.get<boolean>('rust-client.enableMultiProjectSetup', false);
82-
107+
const inMultiProjectMode = true;
83108
const inNestedOuterProjectMode = workspace
84109
.getConfiguration()
85110
.get<boolean>('rust-client.nestedMultiRootConfigInOutermost', true);
@@ -157,10 +182,6 @@ class ClientWorkspace {
157182
}
158183

159184
public async start() {
160-
if (!this.config.multiProjectEnabled) {
161-
warnOnMissingCargoToml();
162-
}
163-
164185
startSpinner('RLS', 'Starting');
165186

166187
const serverOptions: ServerOptions = async () => {
@@ -414,16 +435,6 @@ class ClientWorkspace {
414435
}
415436
}
416437

417-
async function warnOnMissingCargoToml() {
418-
const files = await workspace.findFiles('Cargo.toml');
419-
420-
if (files.length < 1) {
421-
window.showWarningMessage(
422-
'A Cargo.toml file must be at the root of the workspace in order to support all features. Alternatively set rust-client.enableMultiProjectSetup=true in settings.',
423-
);
424-
}
425-
}
426-
427438
/**
428439
* Tracks the most current VSCode workspace as opened by the user. Used by the
429440
* commands to know in which workspace these should be executed.

0 commit comments

Comments
 (0)