Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ class DefaultClient implements Client {

public handleConfigurationProviderSelectCommand(): void {
this.notifyWhenReady(() => {
ui.showConfigurationProviders()
ui.showConfigurationProviders(this.configuration.CurrentConfigurationProvider)
.then(extensionId => {
if (extensionId === undefined) {
// operation was cancelled.
Expand Down
13 changes: 12 additions & 1 deletion Extension/src/LanguageServer/configurations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,11 @@ export class CppProperties {
});
} else {
let settings: CppSettings = new CppSettings(this.rootUri);
settings.update("default.configurationProvider", providerId);
if (providerId) {
settings.update("default.configurationProvider", providerId);
} else {
settings.update("default.configurationProvider", undefined); // delete the setting
}
this.CurrentConfiguration.configurationProvider = providerId;
resolve();
}
Expand Down Expand Up @@ -513,6 +517,13 @@ export class CppProperties {
this.resetToDefaultSettings(true);
}
this.applyDefaultIncludePathsAndFrameworks();
let settings: CppSettings = new CppSettings(this.rootUri);
if (settings.defaultConfigurationProvider) {
this.configurationJson.configurations.forEach(config => {
config.configurationProvider = settings.defaultConfigurationProvider;
});
settings.update("default.configurationProvider", undefined); // delete the setting
}
edit.insert(document.uri, new vscode.Position(0, 0), JSON.stringify(this.configurationJson, null, 4));
vscode.workspace.applyEdit(edit).then((status) => {
// Fix for issue 163
Expand Down
8 changes: 6 additions & 2 deletions Extension/src/LanguageServer/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,18 @@ export class UI {
.then(selection => (selection) ? selection.index : -1);
}

public showConfigurationProviders(): Thenable<string|undefined> {
public showConfigurationProviders(currentProvider: string|null): Thenable<string|undefined> {
let options: vscode.QuickPickOptions = {};
options.placeHolder = "Select a Configuration Provider...";
let providers: CustomConfigurationProviderCollection = getCustomConfigProviders();

let items: KeyedQuickPickItem[] = [];
providers.forEach(provider => {
items.push({ label: provider.name, description: "", key: provider.extensionId });
let label: string = provider.name;
if (provider.extensionId === currentProvider) {
label += " (active)";
}
items.push({ label: label, description: "", key: provider.extensionId });
});
items.push({ label: "(none)", description: "Disable the active configuration provider, if applicable.", key: "" });

Expand Down