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 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
66 changes: 33 additions & 33 deletions Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1625,16 +1625,16 @@
"enum": [
"clangFormat",
"vcFormat",
"Default",
"Disabled"
"default",
"disabled"
],
"markdownEnumDescriptions": [
"%c_cpp.configuration.formatting.clangFormat.markdownDescription%",
"%c_cpp.configuration.formatting.vcFormat.markdownDescription%",
"%c_cpp.configuration.formatting.Default.markdownDescription%",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe these string for the enum descriptions should be updated too?

"%c_cpp.configuration.formatting.Disabled.markdownDescription%"
],
"default": "Default",
"default": "default",
"description": "%c_cpp.configuration.formatting.description%",
"scope": "resource"
},
Expand Down Expand Up @@ -2158,11 +2158,11 @@
"C_Cpp.intelliSenseEngine": {
"type": "string",
"enum": [
"Default",
"default",
"Tag Parser",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the "Tag Parser" enum? That seems inconsistent now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be "tagParser"? The C++ side might need updating.

"Disabled"
"disabled"
],
"default": "Default",
"default": "default",
"description": "%c_cpp.configuration.intelliSenseEngine.description%",
"enumDescriptions": [
"%c_cpp.configuration.intelliSenseEngine.default.description%",
Expand All @@ -2174,20 +2174,20 @@
"C_Cpp.intelliSenseEngineFallback": {
"type": "string",
"enum": [
"Enabled",
"Disabled"
"enabled",
"disabled"
],
"default": "Disabled",
"default": "disabled",
"markdownDescription": "%c_cpp.configuration.intelliSenseEngineFallback.markdownDescription%",
"scope": "resource"
},
"C_Cpp.autocomplete": {
"type": "string",
"enum": [
"Default",
"Disabled"
"default",
"disabled"
],
"default": "Default",
"default": "default",
"markdownDescription": "%c_cpp.configuration.autocomplete.markdownDescription%",
"enumDescriptions": [
"%c_cpp.configuration.autocomplete.default.description%",
Expand All @@ -2198,11 +2198,11 @@
"C_Cpp.errorSquiggles": {
"type": "string",
"enum": [
"Enabled",
"Disabled",
"EnabledIfIncludesResolve"
"enabled",
"disabled",
"enabledIfIncludesResolve"
],
"default": "EnabledIfIncludesResolve",
"default": "enabledIfIncludesResolve",
"description": "%c_cpp.configuration.errorSquiggles.description%",
"scope": "resource"
},
Expand Down Expand Up @@ -2393,10 +2393,10 @@
"C_Cpp.configurationWarnings": {
"type": "string",
"enum": [
"Enabled",
"Disabled"
"enabled",
"disabled"
],
"default": "Enabled",
"default": "enabled",
"description": "%c_cpp.configuration.configurationWarnings.description%",
"scope": "resource"
},
Expand Down Expand Up @@ -2649,10 +2649,10 @@
"C_Cpp.experimentalFeatures": {
"type": "string",
"enum": [
"Enabled",
"Disabled"
"enabled",
"disabled"
],
"default": "Disabled",
"default": "disabled",
"description": "%c_cpp.configuration.experimentalFeatures.description%",
"scope": "window"
},
Expand All @@ -2675,10 +2675,10 @@
"C_Cpp.enhancedColorization": {
"type": "string",
"enum": [
"Enabled",
"Disabled"
"enabled",
"disabled"
],
"default": "Enabled",
"default": "enabled",
"markdownDescription": "%c_cpp.configuration.enhancedColorization.markdownDescription%",
"scope": "window"
},
Expand Down Expand Up @@ -2709,10 +2709,10 @@
"C_Cpp.codeFolding": {
"type": "string",
"enum": [
"Enabled",
"Disabled"
"enabled",
"disabled"
],
"default": "Enabled",
"default": "enabled",
"description": "%c_cpp.configuration.codeFolding.description%",
"scope": "window"
},
Expand Down Expand Up @@ -5103,27 +5103,27 @@
"editor/context": [
{
"command": "C_Cpp.SwitchHeaderSource",
"when": "config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cuda-cpp'",
"when": "config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cuda-cpp'",
"group": "custom1@1"
},
{
"command": "workbench.action.gotoSymbol",
"when": "config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cuda-cpp'",
"when": "config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cuda-cpp'",
"group": "custom1@2"
},
{
"command": "workbench.action.showAllSymbols",
"when": "config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cuda-cpp'",
"when": "config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cpp' || config.C_Cpp.intelliSenseEngine != 'disabled' && config.C_Cpp.intelliSenseEngine != 'Disabled' && editorLangId == 'cuda-cpp'",
"group": "custom1@3"
},
{
"command": "C_Cpp.RunCodeAnalysisOnActiveFile",
"when": "config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'cpp' || 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' && editorLangId == 'c' || config.C_Cpp.intelliSenseEngine == 'Default' && editorLangId == 'cpp' || 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
4 changes: 2 additions & 2 deletions Extension/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
"c_cpp.configuration.intelliSenseEngine.tagParser.description": "Provides \"fuzzy\" results that are not context-aware.",
"c_cpp.configuration.intelliSenseEngine.disabled.description": "Turns off C/C++ language service features.",
"c_cpp.configuration.intelliSenseEngineFallback.markdownDescription": { "message": "Controls whether the IntelliSense engine will automatically switch to the Tag Parser for translation units containing `#include` errors.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.autocomplete.markdownDescription": { "message": "Controls the auto-completion provider. If `Disabled` and you want word-based completion, you will also need to set `\"[cpp]\": {\"editor.wordBasedSuggestions\": true}` (and similarly for `c` and `cuda-cpp` languages).", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.autocomplete.markdownDescription": { "message": "Controls the auto-completion provider. If `disabled` and you want word-based completion, you will also need to set `\"[cpp]\": {\"editor.wordBasedSuggestions\": true}` (and similarly for `c` and `cuda-cpp` languages).", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.autocomplete.default.description": "Uses the active IntelliSense engine.",
"c_cpp.configuration.autocomplete.disabled.description": "Uses the word-based completion provided by Visual Studio Code.",
"c_cpp.configuration.errorSquiggles.description": "Controls whether suspected compile errors detected by the IntelliSense engine will be reported back to the editor. It also controls whether code analysis warnings are reported if includes can't be found. This setting is ignored by the Tag Parser engine.",
Expand Down Expand Up @@ -227,7 +227,7 @@
"c_cpp.configuration.experimentalFeatures.description": "Controls whether \"experimental\" features are usable.",
"c_cpp.configuration.suggestSnippets.markdownDescription": { "message": "If `true`, snippets are provided by the language server.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.caseSensitiveFileSupport.markdownDescription": { "message": "If set to `default`, the file system of the workspace is assumed to be case insensitive on Windows and case sensitive on macOS or Linux. If set to `enabled`, the file system of the workspace is assumed to be case sensitive on Windows.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.enhancedColorization.markdownDescription": { "message": "If enabled, code is colorized based on IntelliSense. This setting only applies if `#C_Cpp.intelliSenseEngine#` is set to `Default`.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.enhancedColorization.markdownDescription": { "message": "If enabled, code is colorized based on IntelliSense. This setting only applies if `#C_Cpp.intelliSenseEngine#` is set to `default`.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
"c_cpp.configuration.codeFolding.description": "If enabled, code folding ranges are provided by the language server.",
browntarik marked this conversation as resolved.
Show resolved Hide resolved
"c_cpp.configuration.vcpkg.enabled.markdownDescription": { "message": "Enable integration services for the [vcpkg dependency manager](https://aka.ms/vcpkg/).", "comment": [ "Markdown text between () should not be altered: https://en.wikipedia.org/wiki/Markdown" ] },
"c_cpp.configuration.addNodeAddonIncludePaths.markdownDescription": { "message": "Add include paths from `nan` and `node-addon-api` when they are dependencies.", "comment": [ "Markdown text between `` should not be translated or localized (they represent literal text) and the capitalization, spacing, and punctuation (including the ``) should not be altered." ] },
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 === "Disabled";
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
14 changes: 7 additions & 7 deletions Extension/src/LanguageServer/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ export class DefaultClient implements Client {
this.disposables.push(vscode.languages.registerDocumentSymbolProvider(this.documentSelector, new DocumentSymbolProvider(this), undefined));
this.disposables.push(vscode.languages.registerCodeActionsProvider(this.documentSelector, new CodeActionProvider(this), undefined));
const settings: CppSettings = new CppSettings();
if (settings.formattingEngine !== "Disabled") {
if (settings.formattingEngine !== "disabled") {
browntarik marked this conversation as resolved.
Show resolved Hide resolved
this.documentFormattingProviderDisposable = vscode.languages.registerDocumentFormattingEditProvider(this.documentSelector, new DocumentFormattingEditProvider(this));
this.formattingRangeProviderDisposable = vscode.languages.registerDocumentRangeFormattingEditProvider(this.documentSelector, new DocumentRangeFormattingEditProvider(this));
this.onTypeFormattingProviderDisposable = vscode.languages.registerOnTypeFormattingEditProvider(this.documentSelector, new OnTypeFormattingEditProvider(this), ";", "}", "\n");
Expand Down Expand Up @@ -1162,10 +1162,10 @@ export class DefaultClient implements Client {
settings_clangFormatFallbackStyle.push(setting.clangFormatFallbackStyle);
settings_clangFormatSortIncludes.push(setting.clangFormatSortIncludes);
settings_intelliSenseEngine.push(setting.intelliSenseEngine);
settings_intelliSenseEngineFallback.push(setting.intelliSenseEngineFallback);
settings_intelliSenseEngineFallback.push(setting.intelliSenseEngineFallback ? "enabled" : "disabled");
settings_errorSquiggles.push(setting.errorSquiggles);
settings_dimInactiveRegions.push(setting.dimInactiveRegions);
settings_enhancedColorization.push(workspaceSettings.enhancedColorization ? "Enabled" : "Disabled");
settings_enhancedColorization.push(workspaceSettings.enhancedColorization ? "enabled" : "disabled");
settings_suggestSnippets.push(setting.suggestSnippets);
settings_exclusionPolicy.push(setting.exclusionPolicy);
settings_preferredPathSeparator.push(setting.preferredPathSeparator);
Expand Down Expand Up @@ -1375,7 +1375,7 @@ export class DefaultClient implements Client {
systemIncludePath: settings_defaultSystemIncludePath
},
vcpkg_root: util.getVcpkgRoot(),
experimentalFeatures: workspaceSettings.experimentalFeatures,
experimentalFeatures: workspaceSettings.experimentalFeatures ? "enabled" : "disabled",
edgeMessagesDirectory: path.join(util.getExtensionFilePath("bin"), "messages", getLocaleId()),
localizedStrings: localizedStrings,
packageVersion: util.packageJson.version,
Expand Down Expand Up @@ -1526,7 +1526,7 @@ export class DefaultClient implements Client {
const settings: CppSettings = new CppSettings();
if (changedSettings["formatting"]) {
const folderSettings: CppSettings = new CppSettings(this.RootUri);
if (folderSettings.formattingEngine !== "Disabled") {
if (folderSettings.formattingEngine !== "disabled") {
browntarik marked this conversation as resolved.
Show resolved Hide resolved
// Because the setting is not a bool, changes do not always imply we need to
// register/unregister the providers.
if (!this.documentFormattingProviderDisposable) {
Expand Down Expand Up @@ -1962,7 +1962,7 @@ export class DefaultClient implements Client {
return;
}
const settings: CppSettings = new CppSettings(this.RootUri);
if (settings.configurationWarnings === "Enabled" && !this.isExternalHeader(docUri) && !vscode.debug.activeDebugSession) {
if (settings.configurationWarnings === true && !this.isExternalHeader(docUri) && !vscode.debug.activeDebugSession) {
const dismiss: string = localize("dismiss.button", "Dismiss");
const disable: string = localize("diable.warnings.button", "Disable Warnings");
const configName: string | undefined = this.configuration.CurrentConfiguration?.name;
Expand All @@ -1979,7 +1979,7 @@ export class DefaultClient implements Client {
vscode.window.showInformationMessage(message, dismiss, disable).then(response => {
switch (response) {
case disable: {
settings.toggleSetting("configurationWarnings", "Enabled", "Disabled");
settings.toggleSetting("configurationWarnings", "enabled", "disabled");
break;
}
}
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 === "Disabled") {
if (new CppSettings(ext.getActiveClient().RootUri).intelliSenseEngine === "disabled") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this need to be compared against in a case insensitive way? Perhaps there is a toLowerCase() needed here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could lower case these in the getters in settings.ts so they always return lower case strings. Then all comparisons between settings originating from these getters would not need any conversions. That would seem simpler, as we'd need to deal with potentially different casing in much fewer places (no other places?).

Also, for setters that are simply enabled/disabled, it would be most efficient if they were converted into bools by the getters in settings.ts, so could thereafter be evaluated as bools instead of needing to do any more expensive string conversions/comparisons.

console.warn("Language service is disabled. Provider will not be registered.");
return false;
}
Expand Down
Loading