From 5d325d3ba2c22d3e931e141acdb67ab865a134e5 Mon Sep 17 00:00:00 2001 From: Sneha Ramachandran Date: Mon, 22 Jan 2024 13:28:32 -0500 Subject: [PATCH 1/2] added inherit option and inheritDefault setting --- CHANGELOG.md | 3 +- docs/cmake-options-configuration.md | 48 ++++-- package.json | 231 +++++++++++++++++++++++----- package.nls.json | 30 +++- src/config.ts | 24 ++- src/status.ts | 8 + 6 files changed, 279 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8536f19e6..c8572038d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,8 @@ Improvements: - Improve when the "Configure with Debugger" popup appears and allow for "Do Not Show Again". [#3343](https://github.com/microsoft/vscode-cmake-tools/issues/3343) - Add option to disable "Not all open documents were saved" popup. [#2889](https://github.com/microsoft/vscode-cmake-tools/issues/2889) -- Allow overriding of CMakePresets cache variables and arguments [#1836](https://github.com/microsoft/vscode-cmake-tools/issues/1836) +- Allow overriding of CMakePresets cache variables and arguments. [#1836](https://github.com/microsoft/vscode-cmake-tools/issues/1836) +- Improve advanced status bar options configuration by adding an `inherit` option to the `statusBarVisibility` setting and by adding the `inheritDefault` setting. Look at the CMake Options Visibility Configuration docs for more information. [#3452](https://github.com/microsoft/vscode-cmake-tools/issues/3452) Bug Fixes: diff --git a/docs/cmake-options-configuration.md b/docs/cmake-options-configuration.md index 5e1087924..ea7f36f50 100644 --- a/docs/cmake-options-configuration.md +++ b/docs/cmake-options-configuration.md @@ -13,13 +13,13 @@ The default settings will be set to the following: "cmake.options.statusBarVisibility": "hidden" "cmake.options.advanced": { "build": { - "statusBarVisibility": "visible" + "statusBarVisibility": "inherit" }, "launch": { - "statusBarVisibility": "visible" + "statusBarVisibility": "inherit" }, "debug": { - "statusBarVisibility": "visible" + "statusBarVisibility": "inherit" } } ``` @@ -34,7 +34,11 @@ To revert to the prior experience and have all of your presets display in the st You can configure settings for each of the following CMake actions in your settings.json to either be `visible` or `hidden` in the status bar through the `statusBarVisibility` variable. Settings that are available to be hidden from the project status view side bar can be configured to be `visible` or `hidden` through the `projectStatusVisibility` variable. -To make options visible in the status bar take up less space, you can configure certain options to be only the respective icon through the `icon` option in `statusBarVisibility` or specify a given character length through the `compact` option in `statusBarVisibility`. If a `statusBarVisibility` option is set to `compact` you can then specify an integer length for how many characters you want an option to take up through the `statusBarLength` option. It will truncate your existing status bar option to that specified character length. The default option is 20 characters. +To make options visible in the status bar take up less space, you can configure certain options to be only the respective icon through the `icon` option in `statusBarVisibility`, inherit the more general `Cmake > Options : Status Bar Visibility` setting or the `inheritDefault` setting through the `inherit` option in `statusBarVisibility`, or specify a given character length through the `compact` option in `statusBarVisibility`. + +If a `statusBarVisibility` option is set to `inherit`, it will only inherit the more general `Cmake > Options : Status Bar Visibility` setting if it is not set to `hidden`. If the more general `Cmake > Options : Status Bar Visibility` setting is set to `hidden`, then the `inherit` option will default to what is set in the `inheritDefault` setting. The default option for `inheritDefault` is `visible`. + +If a `statusBarVisibility` option is set to `compact` you can then specify an integer length for how many characters you want an option to take up through the `statusBarLength` option. It will truncate your existing status bar option to that specified character length. The default option for `statusBarLength` is 20 characters. Note, if the `statusBarVisibility` option is set specifically for `variant`, `compact` will remove the status message completely instead of truncating (there is no corresponding `statusBarLength` setting). You can also configure options to be `visible` or `hidden` in the Project Status View in the CMake Tools sidebar. The options that allow for this customization are: *`folder` @@ -53,7 +57,8 @@ The full level of options for the CMake status can be seen below: "cmake.options.advanced": { "folder": { - "statusBarVisibility": "visible", "icon", "compact", "hidden", + "statusBarVisibility": "visible", "icon", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "statusBarLength": 20, "projectStatusVisibility": "visible", "hidden" }, @@ -61,48 +66,59 @@ The full level of options for the CMake status can be seen below: "projectStatusVisibility": "visible", "hidden" }, "configurePreset": { - "statusBarVisibility": "visible", "icon", "compact", "hidden", + "statusBarVisibility": "visible", "icon", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "statusBarLength": 20 }, "kit": { - "statusBarVisibility": "visible", "icon", "compact", "hidden", + "statusBarVisibility": "visible", "icon", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "statusBarLength": 20 }, "variant": { - "statusBarVisibility": "visible", "icon", "compact", "hidden" + "statusBarVisibility": "visible", "icon", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", }, "build": { - "statusBarVisibility": "visible", "icon", "hidden", + "statusBarVisibility": "visible", "icon", "hidden", "inherit", + "inheritDefault": "visible", "icon", "hidden", "projectStatusVisibility": "visible", "hidden" }, "buildPreset": { - "statusBarVisibility": "visible", "icon", "compact", "hidden", + "statusBarVisibility": "visible", "icon", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "statusBarLength": 20 }, "buildTarget": { - "statusBarVisibility": "visible", "compact", "hidden", + "statusBarVisibility": "visible", "compact", "hidden", "inherit", + "inheritDefault": "visible", "compact", "hidden", "statusBarLength": 20 }, "ctest": { - "statusBarVisibility": "visible", "icon", "compact", "hidden", + "statusBarVisibility": "visible", "icon", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "statusBarLength": 20, "color": true, false, "projectStatusVisibility": "visible", "hidden" }, "testPreset": { - "statusBarVisibility": "visible", "icon", "compact", "hidden", + "statusBarVisibility": "visible", "icon", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "statusBarLength": 20 }, "launchTarget": { - "statusBarVisibility": "visible", "compact", "hidden", + "statusBarVisibility": "visible", "compact", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "statusBarLength": 20 }, "debug": { - "statusBarVisibility": "visible", "hidden", + "statusBarVisibility": "visible", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "projectStatusVisibility": "visible", "hidden" }, "launch": { - "statusBarVisibility": "visible", "hidden", + "statusBarVisibility": "visible", "hidden", "inherit", + "inheritDefault": "visible", "icon", "compact", "hidden", "projectStatusVisibility": "visible", "hidden" } } diff --git a/package.json b/package.json index 4211382e5..4afdc8987 100644 --- a/package.json +++ b/package.json @@ -2490,7 +2490,7 @@ }, "cmake.options.advanced": { "type": "object", - "default": {"build": {"statusBarVisibility": "visible"}, "launch": {"statusBarVisibility": "visible"}, "debug": {"statusBarVisibility": "visible"}}, + "default": {"build": {"statusBarVisibility": "inherit"}, "launch": {"statusBarVisibility": "inherit"}, "debug": {"statusBarVisibility": "inherit"}}, "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.markdownDescription%", "properties": { "configure": { @@ -2520,15 +2520,28 @@ "visible", "compact", "icon", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "icon", + "hidden" + ], + "default": "visible" + }, "statusBarLength": { "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", @@ -2546,15 +2559,28 @@ "visible", "compact", "icon", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "icon", + "hidden" + ], + "default": "visible" + }, "statusBarLength": { "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", @@ -2572,15 +2598,28 @@ "visible", "compact", "icon", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "icon", + "hidden" + ], + "default": "visible" + }, "statusBarLength": { "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", @@ -2598,15 +2637,28 @@ "visible", "compact", "icon", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "icon", + "hidden" + ], + "default": "visible" + }, "statusBarLength": { "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", @@ -2624,14 +2676,27 @@ "visible", "compact", "icon", - "hidden" + "hidden", + "inherit" ], - "enumDescriptions": [ + "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.variant.compact.description%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] + }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "icon", + "hidden" + ], + "default": "visible" } } }, @@ -2645,15 +2710,33 @@ "visible", "compact", "icon", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "icon", + "hidden" + ], + "default": "visible" + }, + "statusBarLength": { + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", + "type": "integer", + "default": 20 + }, "projectStatusVisibility": { "type": "string", "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", @@ -2665,11 +2748,6 @@ "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" ] - }, - "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", - "type": "integer", - "default": 20 } } }, @@ -2682,14 +2760,26 @@ "enum": [ "visible", "compact", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "hidden" + ], + "default": "visible" + }, "statusBarLength": { "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", @@ -2706,14 +2796,26 @@ "enum": [ "visible", "icon", - "hidden" + "hidden", + "inherit" ], - "enumDescriptions": [ + "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "icon", + "hidden" + ], + "default": "visible" + }, "projectStatusVisibility": { "type": "string", "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", @@ -2737,14 +2839,26 @@ "enum": [ "visible", "compact", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "compact", + "hidden" + ], + "default": "visible" + }, "statusBarLength": { "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", @@ -2761,14 +2875,26 @@ "enum": [ "visible", "icon", - "hidden" + "hidden", + "inherit" ], - "enumDescriptions": [ + "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "icon", + "hidden" + ], + "default": "visible" + }, "projectStatusVisibility": { "type": "string", "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", @@ -2792,14 +2918,26 @@ "enum": [ "visible", "icon", - "hidden" + "hidden", + "inherit" ], - "enumDescriptions": [ + "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, + "inheritDefault": { + "type": "string", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", + "enum": [ + "visible", + "icon", + "hidden" + ], + "default": "visible" + }, "projectStatusVisibility": { "type": "string", "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", @@ -2824,26 +2962,27 @@ "visible", "compact", "icon", - "hidden" + "hidden", + "inherit" ], "markdownEnumDescriptions": [ "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description%", "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription%" ] }, - "projectStatusVisibility": { + "inheritDefault": { "type": "string", - "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription%", "enum": [ "visible", + "compact", + "icon", "hidden" ], - "enumDescriptions": [ - "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", - "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" - ] + "default": "visible" }, "color": { "type": "boolean", @@ -2854,6 +2993,18 @@ "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 + }, + "projectStatusVisibility": { + "type": "string", + "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", + "enum": [ + "visible", + "hidden" + ], + "enumDescriptions": [ + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" + ] } } } diff --git a/package.nls.json b/package.nls.json index c92b088ec..232008c57 100644 --- a/package.nls.json +++ b/package.nls.json @@ -172,11 +172,26 @@ "cmake-tools.configuration.cmake.showNotAllDocumentsSavedQuestion": "Enables the pop-up that asks the user if they want to continue the build despite some files possibly not being saved. If not enabled, the build will be continued.", "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.visible.description": "Show the status bar option at full size.", "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.icon.description": "Show the status bar option's icon only.", - "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription": "Show the status bar option with the text truncated to the length specified in `#cmake.status.advanced.statusBarLength#` (default is 20).", + "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.compact.markdownDescription": { + "message": "Show the status bar option with the text truncated to the length specified in `#cmake.status.advanced.statusBarLength#` (default is 20).", + "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." + ] + }, "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.variant.compact.description": "Show the status bar option with the status message removed.", "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description": "Hides the status bar option.", - "cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description": "Show the node in the Project Status View.", - "cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description": "Hide the node and its children in the Project Status View.", + "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.inherit.markdownDescription": { + "message": "If the more general `#cmake.options.statusBarVisibility#` setting is set to `hidden`, this defaults to what is set in the `#cmake.options.advanced.inheritDefault#` setting, else this inherits the `#cmake.options.statusBarVisibility#` setting.", + "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." + ] + }, + "cmake-tools.configuration.cmake.options.advanced.inheritDefault.markdownDescription": { + "message": "Configures what the `#cmake.options.advanced.statusBarVisibility#` setting's `inherit` option defaults to if `#cmake.options.statusBarVisibility#` is set to `hidden`. This has the same options as the `#cmake.options.advanced.statusBarVisibility#` setting, minus the `inherit` option.", + "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." + ] + }, "cmake-tools.configuration.cmake.options.statusBarVisibility.markdownDescription": { "message": "Configures how the extension displays the options in the Status Bar. These settings may be overwritten by the more specific `#cmake.options.advanced.statusBarVisibility#` setting. [More info](https://aka.ms/cmaketoolsoptionsconfiguration).", "comment": [ @@ -189,6 +204,8 @@ "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." ] }, + "cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description": "Show the node in the Project Status View.", + "cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description": "Hide the node and its children in the Project Status View.", "cmake-tools.configuration.cmake.options.advanced.markdownDescription": { "message": "Configures the settings for individual Project Status View and status bar options. These settings may overwrite the more general `#cmake.options.statusBarVisibility#` setting. [More info](https://aka.ms/cmaketoolsoptionsconfiguration).", "comment": [ @@ -197,7 +214,12 @@ }, "cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description": "Configures how the extension displays this option the Project Status View.", "cmake-tools.configuration.cmake.options.advanced.ctest.color.description": "Enables a change in color for this option depending on test results.", - "cmake-tools.configuration.cmake.options.advanced.statusBarLength.description": "Configures the maximum length of visible text in the Status Bar when set to 'compact' mode.", + "cmake-tools.configuration.cmake.options.advanced.statusBarLength.markdownDescription": { + "message": "Configures the maximum length of visible text in the Status Bar when set to `compact` mode.", + "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." + ] + }, "cmake-tools.configuration.views.cmake.folders.description": "Folders", "cmake-tools.configuration.views.cmake.projectStatus.description": "Project Status", "cmake-tools.configuration.views.cmake.outline.description": "Project Outline", diff --git a/src/config.ts b/src/config.ts index ee4b7d945..f3672389b 100644 --- a/src/config.ts +++ b/src/config.ts @@ -23,10 +23,14 @@ const log = logging.createLogger('config'); export type LogLevelKey = 'trace' | 'debug' | 'info' | 'note' | 'warning' | 'error' | 'fatal'; export type CMakeCommunicationMode = 'legacy' | 'serverApi' | 'fileApi' | 'automatic'; -export type StatusBarOptionVisibility = "visible" | "compact" | "icon" | "hidden"; -export type StatusBarStaticOptionVisibility = "visible" | "icon" | "hidden"; -export type StatusBarTextOptionVisibility = "visible" | "compact" | "hidden"; -export type StatusBarIconOptionVisibility = "visible" | "hidden"; +export type StatusBarOptionVisibility = "visible" | "compact" | "icon" | "hidden" | "inherit"; +export type StatusBarInheritOptionVisibility = "visible" | "compact" | "icon" | "hidden"; +export type StatusBarStaticOptionVisibility = "visible" | "icon" | "hidden" | "inherit"; +export type StatusBarInheritStaticOptionVisibility = "visible" | "icon" | "hidden"; +export type StatusBarTextOptionVisibility = "visible" | "compact" | "hidden" | "inherit"; +export type StatusBarInheritTextOptionVisibility = "visible" | "compact" | "hidden"; +export type StatusBarIconOptionVisibility = "visible" | "hidden" | "inherit"; +export type StatusBarInheritIconOptionVisibility = "visible" | "hidden" | "inherit"; export type ProjectStatusOptionVisibility = "visible" | "hidden"; export type TouchBarOptionVisibility = "default" | "hidden"; export type UseCMakePresets = 'always' | 'never' | 'auto'; @@ -50,58 +54,70 @@ export interface AdvancedOptionConfig { configurePreset?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarOptionVisibility; + inheritDefault?: StatusBarInheritOptionVisibility; statusBarLength?: number; }; buildPreset?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarOptionVisibility; + inheritDefault?: StatusBarInheritOptionVisibility; statusBarLength?: number; }; testPreset?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarOptionVisibility; + inheritDefault?: StatusBarInheritOptionVisibility; statusBarLength?: number; }; kit?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarOptionVisibility; + inheritDefault?: StatusBarInheritOptionVisibility; statusBarLength?: number; }; variant?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarOptionVisibility; + inheritDefault?: StatusBarInheritOptionVisibility; }; folder?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarOptionVisibility; + inheritDefault?: StatusBarInheritOptionVisibility; statusBarLength?: number; }; buildTarget?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarTextOptionVisibility; + inheritDefault?: StatusBarInheritTextOptionVisibility; statusBarLength?: number; }; build?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarStaticOptionVisibility; + inheritDefault?: StatusBarInheritStaticOptionVisibility; }; launchTarget?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarTextOptionVisibility; + inheritDefault?: StatusBarInheritTextOptionVisibility; statusBarLength?: number; }; debug?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarIconOptionVisibility; + inheritDefault?: StatusBarInheritIconOptionVisibility; }; launch?: { projectStatusVisibility?: ProjectStatusOptionVisibility; statusBarVisibility?: StatusBarIconOptionVisibility; + inheritDefault?: StatusBarInheritIconOptionVisibility; }; ctest?: { projectStatusVisibility?: ProjectStatusOptionVisibility; color?: boolean; statusBarVisibility?: StatusBarOptionVisibility; + inheritDefault?: StatusBarInheritOptionVisibility; statusBarLength?: number; }; } diff --git a/src/status.ts b/src/status.ts index 83509ce5f..3bb36c95b 100644 --- a/src/status.ts +++ b/src/status.ts @@ -134,6 +134,14 @@ abstract class Button { private _getVisibilitySetting(): StatusBarOptionVisibility | StatusBarTextOptionVisibility | StatusBarStaticOptionVisibility | StatusBarIconOptionVisibility | null { if (this.settingsName) { let setting = Object(this.config.options.advanced)[this.settingsName]?.statusBarVisibility; + + if (setting === 'inherit') { + if (this.config.options.statusBarVisibility === 'hidden') { + setting = Object(this.config.options.advanced)[this.settingsName]?.inheritDefault; + } else { + setting = this.config.options.statusBarVisibility; + } + } if (setting === undefined) { setting = this.config.options.statusBarVisibility; } From d4b4dc5d29bf3ac49a51befd0d50f11b86dfe9fe Mon Sep 17 00:00:00 2001 From: Sneha Ramachandran Date: Mon, 22 Jan 2024 13:34:05 -0500 Subject: [PATCH 2/2] fixed docs wording --- docs/cmake-options-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cmake-options-configuration.md b/docs/cmake-options-configuration.md index ea7f36f50..4a3f09957 100644 --- a/docs/cmake-options-configuration.md +++ b/docs/cmake-options-configuration.md @@ -36,7 +36,7 @@ You can configure settings for each of the following CMake actions in your setti To make options visible in the status bar take up less space, you can configure certain options to be only the respective icon through the `icon` option in `statusBarVisibility`, inherit the more general `Cmake > Options : Status Bar Visibility` setting or the `inheritDefault` setting through the `inherit` option in `statusBarVisibility`, or specify a given character length through the `compact` option in `statusBarVisibility`. -If a `statusBarVisibility` option is set to `inherit`, it will only inherit the more general `Cmake > Options : Status Bar Visibility` setting if it is not set to `hidden`. If the more general `Cmake > Options : Status Bar Visibility` setting is set to `hidden`, then the `inherit` option will default to what is set in the `inheritDefault` setting. The default option for `inheritDefault` is `visible`. +If a `statusBarVisibility` option is set to `inherit`, it will inherit the more general `Cmake > Options : Status Bar Visibility` setting if it is not set to `hidden`. If the more general `Cmake > Options : Status Bar Visibility` setting is set to `hidden`, then the `inherit` option will default to what is set in the `inheritDefault` setting. The default option for `inheritDefault` is `visible`. If a `statusBarVisibility` option is set to `compact` you can then specify an integer length for how many characters you want an option to take up through the `statusBarLength` option. It will truncate your existing status bar option to that specified character length. The default option for `statusBarLength` is 20 characters. Note, if the `statusBarVisibility` option is set specifically for `variant`, `compact` will remove the status message completely instead of truncating (there is no corresponding `statusBarLength` setting).