Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change to camelCase for Default, Enabled, Disabled #9862

Merged
merged 15 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5118,12 +5118,12 @@
},
{
"command": "C_Cpp.RunCodeAnalysisOnActiveFile",
"when": "config.C_Cpp.intelliSenseEngine != 'default' && config.C_Cpp.intelliSenseEngine != 'Default' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'default' && config.C_Cpp.intelliSenseEngine != 'Default' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'default' && config.C_Cpp.intelliSenseEngine != 'Default' && editorLangId == 'cuda-cpp'",
"when": "config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine == 'default' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine == 'default' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'cuda-cpp' || config.C_Cpp.intelliSenseEngine == 'default' && editorLangId == 'cuda-cpp'",
"group": "custom2@1"
},
{
"command": "C_Cpp.RestartIntelliSenseForFile",
"when": "config.C_Cpp.intelliSenseEngine != 'default' && config.C_Cpp.intelliSenseEngine != 'Default' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'default' && config.C_Cpp.intelliSenseEngine != 'Default' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'default' && config.C_Cpp.intelliSenseEngine != 'Default' && editorLangId == 'cuda-cpp'",
"when": "config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine == 'default' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine == 'default' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'cuda-cpp' || config.C_Cpp.intelliSenseEngine == 'default' && editorLangId == 'cuda-cpp'",
"group": "custom2@2"
},
{
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/Debugger/configurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv

if (config.preLaunchTask) {
config.configSource = this.getDebugConfigSource(config, folder);
const isIntelliSenseDisabled: boolean = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined).intelliSenseEngine === false;
const isIntelliSenseDisabled: boolean = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined).intelliSenseEngine === "Disabled";
browntarik marked this conversation as resolved.
Show resolved Hide resolved
// Run the build task if IntelliSense is disabled.
if (isIntelliSenseDisabled) {
try {
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ export class DefaultClient implements Client {
settings_clangFormatStyle.push(setting.clangFormatStyle);
settings_clangFormatFallbackStyle.push(setting.clangFormatFallbackStyle);
settings_clangFormatSortIncludes.push(setting.clangFormatSortIncludes);
settings_intelliSenseEngine.push(setting.intelliSenseEngine ? "enabled" : "disabled");
settings_intelliSenseEngine.push(setting.intelliSenseEngine);
settings_intelliSenseEngineFallback.push(setting.intelliSenseEngineFallback ? "enabled" : "disabled");
settings_errorSquiggles.push(setting.errorSquiggles);
settings_dimInactiveRegions.push(setting.dimInactiveRegions);
Expand Down
2 changes: 1 addition & 1 deletion Extension/src/LanguageServer/customProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class CustomConfigurationProviderCollection {
}

public add(provider: CustomConfigurationProvider, version: Version): boolean {
if (new CppSettings(ext.getActiveClient().RootUri).intelliSenseEngine === false) {
if (new CppSettings(ext.getActiveClient().RootUri).intelliSenseEngine === "Disabled") {
browntarik marked this conversation as resolved.
Show resolved Hide resolved
console.warn("Language service is disabled. Provider will not be registered.");
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions Extension/src/LanguageServer/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class CppSettings extends Settings {
public get clangFormatSortIncludes(): string | undefined { return super.Section.get<string>("clang_format_sortIncludes"); }
public get experimentalFeatures(): boolean | undefined { return super.Section.get<string>("experimentalFeatures")?.toLowerCase() === "enabled"; }
public get suggestSnippets(): boolean | undefined { return super.Section.get<boolean>("suggestSnippets"); }
public get intelliSenseEngine(): boolean | undefined { return super.Section.get<string>("intelliSenseEngine")?.toLowerCase() === "enabled"; }
public get intelliSenseEngine(): string | undefined { return super.Section.get<string>("intelliSenseEngine"); }
browntarik marked this conversation as resolved.
Show resolved Hide resolved
public get intelliSenseEngineFallback(): boolean | undefined { return super.Section.get<string>("intelliSenseEngineFallback")?.toLowerCase() === "enabled"; }
public get intelliSenseCachePath(): string | undefined { return super.Section.get<string>("intelliSenseCachePath"); }
public get intelliSenseCacheSize(): number | undefined { return super.Section.get<number>("intelliSenseCacheSize"); }
Expand Down Expand Up @@ -288,7 +288,7 @@ export class CppSettings extends Settings {

public get enhancedColorization(): boolean {
return super.Section.get<string>("enhancedColorization")?.toLowerCase() === "enabled"
&& super.Section.get<string>("intelliSenseEngine")?.toLowerCase() === "default"
&& super.Section.get<string>("intelliSenseEngine") === "Default"
browntarik marked this conversation as resolved.
Show resolved Hide resolved
&& vscode.workspace.getConfiguration("workbench").get<string>("colorTheme") !== "Default High Contrast";
}

browntarik marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -560,7 +560,7 @@ export class CppSettings extends Settings {

public get dimInactiveRegions(): boolean {
return super.Section.get<boolean>("dimInactiveRegions") === true
&& super.Section.get<string>("intelliSenseEngine")?.toLowerCase() === "default"
&& super.Section.get<string>("intelliSenseEngine") === "Default"
browntarik marked this conversation as resolved.
Show resolved Hide resolved
&& vscode.workspace.getConfiguration("workbench").get<string>("colorTheme") !== "Default High Contrast";
}

Expand Down
10 changes: 5 additions & 5 deletions Extension/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,21 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
// Read the setting and determine whether we should activate the language server prior to installing callbacks,
// to ensure there is no potential race condition. LanguageServer.activate() is called near the end of this
// function, to allow any further setup to occur here, prior to activation.
const isIntelliSenseEngineDisabled: boolean = settings.intelliSenseEngine === false;
const isIntelliSenseEngineDisabled: boolean = settings.intelliSenseEngine === "Disabled";
browntarik marked this conversation as resolved.
Show resolved Hide resolved
const shouldActivateLanguageServer: boolean = (!isIntelliSenseEngineDisabled && !isOldMacOs);

if (isOldMacOs) {
languageServiceDisabled = true;
vscode.window.showErrorMessage(localize("macos.version.deprecated", "Versions of the C/C++ extension more recent than {0} require at least macOS version {1}.", "1.9.8", "10.12"));
} else {
if (settings.intelliSenseEngine === false) {
if (settings.intelliSenseEngine === "Disabled") {
browntarik marked this conversation as resolved.
Show resolved Hide resolved
languageServiceDisabled = true;
}
let currentIntelliSenseEngineValue: boolean | undefined = settings.intelliSenseEngine;
let currentIntelliSenseEngineValue: string | undefined = settings.intelliSenseEngine;
disposables.push(vscode.workspace.onDidChangeConfiguration(() => {
const settings: CppSettings = new CppSettings((vscode.workspace.workspaceFolders && vscode.workspace.workspaceFolders.length > 0) ? vscode.workspace.workspaceFolders[0]?.uri : undefined);
if (!reloadMessageShown && settings.intelliSenseEngine !== currentIntelliSenseEngineValue) {
if (currentIntelliSenseEngineValue === false) {
if (currentIntelliSenseEngineValue === "Disabled") {
browntarik marked this conversation as resolved.
Show resolved Hide resolved
// If switching from disabled to enabled, we can continue activation.
currentIntelliSenseEngineValue = settings.intelliSenseEngine;
languageServiceDisabled = false;
browntarik marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -141,7 +141,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<CppToo
LanguageServer.registerCommands(false);
// The check here for isIntelliSenseEngineDisabled avoids logging
// the message on old Macs that we've already displayed a warning for.
log(localize("intellisense.disabled", "intelliSenseEngine is disabled"));
log(localize("intellisense.disabled", "intelliSenseEngine is Disabled"));
browntarik marked this conversation as resolved.
Show resolved Hide resolved
}

return cppTools;
Expand Down