From 7f35a4a4efd9ae55ac5f15eb91b1a08e63b7e14f Mon Sep 17 00:00:00 2001 From: snehara99 Date: Wed, 1 Nov 2023 14:43:28 -0400 Subject: [PATCH] changed setting name from cmake.status to cmake.options and updated notification --- CHANGELOG.md | 2 +- package.json | 174 ++++++++++++++++----------------- package.nls.json | 32 +++--- src/cmakeProject.ts | 12 +-- src/config.ts | 90 ++++++++--------- src/extension.ts | 6 +- src/projectController.ts | 36 +++---- src/projectStatus.ts | 30 +++--- src/status.ts | 28 +++--- test/unit-tests/config.test.ts | 2 +- 10 files changed, 206 insertions(+), 206 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fa2250e6..ecac2208a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ Improvements: - If the "configure" button of CMakeLists.txt node in the Project Outline is clicked, only the corresponding project is configured. [PR #3372](https://github.com/microsoft/vscode-cmake-tools/pull/3372) [@vlavati](https://github.com/vlavati) - Added a command to directly open the extension settings (`CMake: Open CMake Tools Extension Settings`) and a gear icon button in the Project Status View title bar that calls it. [PR #3403](https://github.com/microsoft/vscode-cmake-tools/pull/3403) - Added an icon button in the Project Status View title bar that calls the `CMake: Delete Cache and Reconfigure` command. [PR #3403](https://github.com/microsoft/vscode-cmake-tools/pull/3403) -- By default, all of the status bar options are hidden except `build`, `debug`, and `launch`. All of the previous status bar options are now, by default, visible in the Project Status View. These visibility settings can be customized in the `cmake.status.advanced` setting. This setting can also be accessed via the Project Status View. The `cmake.useProjectStatusView` setting is now removed. [PR #3407](https://github.com/microsoft/vscode-cmake-tools/pull/3407) +- By default, all of the status bar options are hidden except `build`, `debug`, and `launch`. All of the previous status bar options are now, by default, visible in the Project Status View. These visibility settings can be customized in the `cmake.options.advanced` setting. This setting can also be accessed via the Project Status View. The `cmake.useProjectStatusView` setting is now removed. [PR #3407](https://github.com/microsoft/vscode-cmake-tools/pull/3407) & [PR #3417](https://github.com/microsoft/vscode-cmake-tools/pull/3417) Bug Fixes: - Fix Unhandled Exception if no args are specified in `cmake.getLaunchTargetFilename` inside an input context of a task. [PR #3348](https://github.com/microsoft/vscode-cmake-tools/issues/3348) [@vlavati](https://github.com/vlavati) diff --git a/package.json b/package.json index 6def02591..84f722aa6 100644 --- a/package.json +++ b/package.json @@ -2416,10 +2416,10 @@ "description": "%cmake-tools.configuration.cmake.showOptionsMovedNotification%", "scope": "application" }, - "cmake.status.statusBarVisibility": { + "cmake.options.statusBarVisibility": { "type": "string", "default": "hidden", - "markdownDescription": "%cmake-tools.configuration.cmake.status.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2428,24 +2428,24 @@ ], "scope": "window" }, - "cmake.status.advanced": { + "cmake.options.advanced": { "type": "object", "default": {"build": {"statusBarVisibility": "visible"}, "launch": {"statusBarVisibility": "visible"}, "debug": {"statusBarVisibility": "visible"}}, - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.markdownDescription%", "properties": { "configure": { "type": "object", "properties": { "projectStatusVisibility": { "type": "string", - "description": "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", "enum": [ "visible", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" ] } } @@ -2455,7 +2455,7 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2464,13 +2464,13 @@ ] }, "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ], "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } @@ -2481,7 +2481,7 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2489,14 +2489,14 @@ "hidden" ], "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } @@ -2507,7 +2507,7 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2515,14 +2515,14 @@ "hidden" ], "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } @@ -2533,7 +2533,7 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2541,25 +2541,25 @@ "hidden" ], "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } } }, - "variantStatus": { + "variant": { "type": "object", "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2567,10 +2567,10 @@ "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.variantStatus.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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.variantStatus.description%", + "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.hidden.description%" ] } } @@ -2580,7 +2580,7 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2588,26 +2588,26 @@ "hidden" ], "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "projectStatusVisibility": { "type": "string", - "description": "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", "enum": [ "visible", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" ] }, "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } @@ -2618,20 +2618,20 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", "hidden" ], "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } @@ -2642,28 +2642,28 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "icon", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "projectStatusVisibility": { "type": "string", - "description": "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", "enum": [ "visible", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" ] } } @@ -2673,20 +2673,20 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", "hidden" ], "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } @@ -2697,28 +2697,28 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "icon", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "projectStatusVisibility": { "type": "string", - "description": "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", "enum": [ "visible", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" ] } } @@ -2728,28 +2728,28 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "icon", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "projectStatusVisibility": { "type": "string", - "description": "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", "enum": [ "visible", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" ] } } @@ -2759,7 +2759,7 @@ "properties": { "statusBarVisibility": { "type": "string", - "markdownDescription": "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.markdownDescription%", + "markdownDescription": "%cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription%", "enum": [ "visible", "compact", @@ -2767,31 +2767,31 @@ "hidden" ], "markdownEnumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription%", - "%cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description%" + "%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%" ] }, "projectStatusVisibility": { "type": "string", - "description": "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.description%", "enum": [ "visible", "hidden" ], "enumDescriptions": [ - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.visible.description%", - "%cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.hidden.description%" + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.visible.description%", + "%cmake-tools.configuration.cmake.options.advanced.projectStatusVisibility.hidden.description%" ] }, "color": { "type": "boolean", "default": false, - "description": "%cmake-tools.configuration.cmake.status.advanced.ctest.color.description%" + "description": "%cmake-tools.configuration.cmake.options.advanced.ctest.color.description%" }, "statusBarLength": { - "description": "%cmake-tools.configuration.cmake.status.advanced.statusBarLength.description%", + "description": "%cmake-tools.configuration.cmake.options.advanced.statusBarLength.description%", "type": "integer", "default": 20 } diff --git a/package.nls.json b/package.nls.json index 0bd1e7326..5c5b07421 100644 --- a/package.nls.json +++ b/package.nls.json @@ -165,34 +165,34 @@ "cmake-tools.configuration.cmake.touchbar.visibility.default.description": "Show Touch Bar buttons on supported systems.", "cmake-tools.configuration.cmake.touchbar.visibility.hidden.description": "Do not show Touch Bar buttons.", "cmake-tools.configuration.cmake.showOptionsMovedNotification": "Enables the notification regarding the status bar options moving to the Project Status View to show when the extension starts.", - "cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.visible.description": "Show the status bar item at full size.", - "cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.icon.description": "Show the status bar item's icon only.", - "cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.compact.markdownDescription": "Show the status bar item with the text truncated to the length specified in `#cmake.status.advanced.statusBarLength#` (default is 20).", - "cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.variantStatus.compact.description": "Show the status bar item with the status message removed.", - "cmake-tools.configuration.cmake.status.advanced.statusBarVisibility.hidden.description": "Hides the status bar item.", - "cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.visible.description": "Show the node in the Project Status View.", - "cmake-tools.configuration.cmake.status.advanced.projectStatusVisibility.hidden.description": "Hide the node and its children in the Project Status View.", - "cmake-tools.configuration.cmake.status.statusBarVisibility.markdownDescription": { - "message": "Configures how the extension displays the items in the Status Bar. These settings may be overwritten by the more specific `#cmake.status.advanced.statusBarVisibility#` setting. [More info](https://aka.ms/cmaketoolsoptionsconfiguration).", + "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.variantStatus.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.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": [ "Markdown text between `` and () 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.status.advanced.statusBarVisibility.markdownDescription": { - "message": "Configures the settings for individual Status Bar items. These settings overwrite the more general `#cmake.status.statusBarVisibility#` setting.", + "cmake-tools.configuration.cmake.options.advanced.statusBarVisibility.markdownDescription": { + "message": "Configures the settings for individual status bar options. These settings overwrite the more general `#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.status.advanced.markdownDescription": { - "message": "Configures the settings for individual Project Status View and Status Bar items. These settings may overwrite the more general `#cmake.status.statusBarVisibility#` setting. [More info](https://aka.ms/cmaketoolsoptionsconfiguration).", + "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": [ "Markdown text between `` and () 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.status.advanced.projectStatusVisibility.description": "Configures how the extension displays this item the Project Status View.", - "cmake-tools.configuration.cmake.status.advanced.ctest.color.description": "Enables a change in color for this item depending on test results.", - "cmake-tools.configuration.cmake.status.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.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.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/cmakeProject.ts b/src/cmakeProject.ts index dce5402e8..6db6a01e7 100644 --- a/src/cmakeProject.ts +++ b/src/cmakeProject.ts @@ -38,7 +38,7 @@ import { VariantManager } from './variant'; import * as nls from 'vscode-nls'; import { ConfigurationWebview } from './cacheView'; import { enableFullFeatureSet, updateFullFeatureSet } from './extension'; -import { CMakeCommunicationMode, ConfigurationReader, StatusConfig, UseCMakePresets } from './config'; +import { CMakeCommunicationMode, ConfigurationReader, OptionConfig, UseCMakePresets } from './config'; import * as preset from '@cmt/preset'; import * as util from '@cmt/util'; import { Environment, EnvironmentUtils } from './environmentVariables'; @@ -914,7 +914,7 @@ export class CMakeProject { private async init(sourceDirectory: string) { log.debug(localize('second.phase.init', 'Starting CMake Tools second-phase init')); await this.setSourceDir(await util.normalizeAndVerifySourceDir(sourceDirectory, CMakeDriver.sourceDirExpansionOptions(this.workspaceContext.folder.uri.fsPath))); - this.doStatusChange(this.workspaceContext.config.status); + this.doStatusChange(this.workspaceContext.config.options); // Start up the variant manager await this.variantManager.initialize(this.folderName); // Set the status bar message @@ -2825,10 +2825,10 @@ export class CMakeProject { public hideDebugButton: boolean = false; public hideLaunchButton: boolean = false; - doStatusChange(status: StatusConfig) { - this.hideBuildButton = (status?.advanced?.build?.statusBarVisibility === "hidden" && status?.advanced?.build?.projectStatusVisibility === "hidden") ? true : false; - this.hideDebugButton = (status?.advanced?.debug?.statusBarVisibility === "hidden" && status?.advanced?.debug?.projectStatusVisibility === "hidden") ? true : false; - this.hideLaunchButton = (status?.advanced?.launch?.statusBarVisibility === "hidden" && status?.advanced?.launch?.projectStatusVisibility === "hidden") ? true : false; + doStatusChange(options: OptionConfig) { + this.hideBuildButton = (options?.advanced?.build?.statusBarVisibility === "hidden" && options?.advanced?.build?.projectStatusVisibility === "hidden") ? true : false; + this.hideDebugButton = (options?.advanced?.debug?.statusBarVisibility === "hidden" && options?.advanced?.debug?.projectStatusVisibility === "hidden") ? true : false; + this.hideLaunchButton = (options?.advanced?.launch?.statusBarVisibility === "hidden" && options?.advanced?.launch?.projectStatusVisibility === "hidden") ? true : false; } } diff --git a/src/config.ts b/src/config.ts index 3add8a105..b2a1d6445 100644 --- a/src/config.ts +++ b/src/config.ts @@ -23,92 +23,92 @@ const log = logging.createLogger('config'); export type LogLevelKey = 'trace' | 'debug' | 'info' | 'note' | 'warning' | 'error' | 'fatal'; export type CMakeCommunicationMode = 'legacy' | 'serverApi' | 'fileApi' | 'automatic'; -export type StatusBarButtonVisibility = "visible" | "compact" | "icon" | "hidden"; -export type StatusBarStaticButtonVisibility = "visible" | "icon" | "hidden"; -export type StatusBarTextButtonVisibility = "visible" | "compact" | "hidden"; -export type StatusBarIconButtonVisibility = "visible" | "hidden"; -export type ProjectStatusButtonVisibility = "visible" | "hidden"; -export type TouchBarButtonVisibility = "default" | "hidden"; +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 ProjectStatusOptionVisibility = "visible" | "hidden"; +export type TouchBarOptionVisibility = "default" | "hidden"; export type UseCMakePresets = 'always' | 'never' | 'auto'; export interface AdvancedTouchBarConfig { - configure?: TouchBarButtonVisibility; - build?: TouchBarButtonVisibility; - debug?: TouchBarButtonVisibility; - launch?: TouchBarButtonVisibility; + configure?: TouchBarOptionVisibility; + build?: TouchBarOptionVisibility; + debug?: TouchBarOptionVisibility; + launch?: TouchBarOptionVisibility; } export interface TouchBarConfig { advanced?: AdvancedTouchBarConfig; - visibility: TouchBarButtonVisibility; + visibility: TouchBarOptionVisibility; } -export interface AdvancedStatusConfig { +export interface AdvancedOptionConfig { configure?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; }; configurePreset?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarOptionVisibility; statusBarLength?: number; }; buildPreset?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarOptionVisibility; statusBarLength?: number; }; testPreset?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarOptionVisibility; statusBarLength?: number; }; kit?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarOptionVisibility; statusBarLength?: number; }; - variantStatus?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarButtonVisibility; + variant?: { + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarOptionVisibility; }; folder?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarOptionVisibility; statusBarLength?: number; }; buildTarget?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarTextButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarTextOptionVisibility; statusBarLength?: number; }; build?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarStaticButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarStaticOptionVisibility; }; launchTarget?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarTextButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarTextOptionVisibility; statusBarLength?: number; }; debug?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarIconButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarIconOptionVisibility; }; launch?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; - statusBarVisibility?: StatusBarIconButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; + statusBarVisibility?: StatusBarIconOptionVisibility; }; ctest?: { - projectStatusVisibility?: ProjectStatusButtonVisibility; + projectStatusVisibility?: ProjectStatusOptionVisibility; color?: boolean; - statusBarVisibility?: StatusBarButtonVisibility; + statusBarVisibility?: StatusBarOptionVisibility; statusBarLength?: number; }; } -export interface StatusConfig { - advanced?: AdvancedStatusConfig; - statusBarVisibility: StatusBarButtonVisibility; +export interface OptionConfig { + advanced?: AdvancedOptionConfig; + statusBarVisibility: StatusBarOptionVisibility; } export interface ExtensionConfigurationSettings { @@ -162,7 +162,7 @@ export interface ExtensionConfigurationSettings { additionalKits: string[]; touchbar: TouchBarConfig; showOptionsMovedNotification: boolean; - status: StatusConfig; + options: OptionConfig; useCMakePresets: UseCMakePresets; allowCommentsInPresetsFile: boolean; allowUnsupportedPresetsVersions: boolean; @@ -474,8 +474,8 @@ export class ConfigurationReader implements vscode.Disposable { return this.configData.touchbar; } - get status() { - return this.configData.status; + get options() { + return this.configData.options; } get launchBehavior(): string { @@ -537,7 +537,7 @@ export class ConfigurationReader implements vscode.Disposable { additionalKits: new vscode.EventEmitter(), touchbar: new vscode.EventEmitter(), showOptionsMovedNotification: new vscode.EventEmitter(), - status: new vscode.EventEmitter(), + options: new vscode.EventEmitter(), useCMakePresets: new vscode.EventEmitter(), allowCommentsInPresetsFile: new vscode.EventEmitter(), allowUnsupportedPresetsVersions: new vscode.EventEmitter(), diff --git a/src/extension.ts b/src/extension.ts index 9af60720f..e2cd6811a 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -581,7 +581,7 @@ export class ExtensionManager implements vscode.Disposable { // Update the active project private async updateActiveProject(workspaceFolder?: vscode.WorkspaceFolder, editor?: vscode.TextEditor): Promise { - await this.projectController.updateActiveProject(workspaceFolder, editor, this.workspaceConfig.status); + await this.projectController.updateActiveProject(workspaceFolder, editor, this.workspaceConfig.options); await this.postUpdateActiveProject(); } @@ -1928,13 +1928,13 @@ export async function activate(context: vscode.ExtensionContext): Promise { if (selection !== undefined) { if (selection === localize('options.moved.notification.configure.cmake.options', 'Configure CMake Options Visibility')) { - await vscode.commands.executeCommand('workbench.action.openSettings', 'cmake.status'); + await vscode.commands.executeCommand('workbench.action.openSettings', 'cmake.options'); } else if (selection === localize('options.moved.notification.do.not.show', "Do Not Show Again")) { await vscode.workspace.getConfiguration('cmake').update('showOptionsMovedNotification', false, vscode.ConfigurationTarget.Global); } diff --git a/src/projectController.ts b/src/projectController.ts index 6b624a46a..957a7e393 100644 --- a/src/projectController.ts +++ b/src/projectController.ts @@ -9,7 +9,7 @@ import * as logging from '@cmt/logging'; import CMakeProject from '@cmt/cmakeProject'; import rollbar from '@cmt/rollbar'; import { disposeAll, DummyDisposable } from '@cmt/util'; -import { ConfigurationReader, StatusConfig } from './config'; +import { ConfigurationReader, OptionConfig } from './config'; import { CMakeDriver } from './drivers/drivers'; import { DirectoryContext } from './workspace'; import { StateManager } from './state'; @@ -92,19 +92,19 @@ export class ProjectController implements vscode.Disposable { } private activeProject: CMakeProject | undefined; - async updateActiveProject(workspaceFolder?: vscode.WorkspaceFolder, openEditor?: vscode.TextEditor, status?: StatusConfig): Promise { + async updateActiveProject(workspaceFolder?: vscode.WorkspaceFolder, openEditor?: vscode.TextEditor, options?: OptionConfig): Promise { const projects: CMakeProject[] | undefined = this.getProjectsForWorkspaceFolder(workspaceFolder); if (projects && projects.length > 0) { if (openEditor) { for (const project of projects) { if (util.isFileInsideFolder(openEditor.document.uri, project.folderPath)) { - await this.setActiveProject(project, status); + await this.setActiveProject(project, options); break; } } if (!this.activeProject) { if (util.isFileInsideFolder(openEditor.document.uri, projects[0].workspaceFolder.uri.fsPath)) { - await this.setActiveProject(projects[0], status); + await this.setActiveProject(projects[0], options); } } // If active project is found, return. @@ -113,17 +113,17 @@ export class ProjectController implements vscode.Disposable { } } else { // Set a default active project. - await this.setActiveProject(projects[0], status); + await this.setActiveProject(projects[0], options); return; } } await this.setActiveProject(undefined); } - async setActiveProject(project?: CMakeProject, status?: StatusConfig): Promise { + async setActiveProject(project?: CMakeProject, options?: OptionConfig): Promise { this.activeProject = project; void this.updateUsePresetsState(this.activeProject); - await this.projectStatus.updateActiveProject(project, status); + await this.projectStatus.updateActiveProject(project, options); await this.setupProjectSubscriptions(project); } @@ -334,11 +334,11 @@ export class ProjectController implements vscode.Disposable { this.folderToProjectsMap.set(folder.uri.fsPath, projects); const config: ConfigurationReader | undefined = workspaceContext.config; if (config) { - this.sourceDirectorySub.set(folder, config.onChange('sourceDirectory', async (sourceDirectories: string | string[]) => this.doSourceDirectoryChange(folder, sourceDirectories, config.status))); + this.sourceDirectorySub.set(folder, config.onChange('sourceDirectory', async (sourceDirectories: string | string[]) => this.doSourceDirectoryChange(folder, sourceDirectories, config.options))); this.buildDirectorySub.set(folder, config.onChange('buildDirectory', async () => this.refreshDriverSettings(config, folder))); this.installPrefixSub.set(folder, config.onChange('installPrefix', async () => this.refreshDriverSettings(config, folder))); this.useCMakePresetsSub.set(folder, config.onChange('useCMakePresets', async (useCMakePresets: string) => this.doUseCMakePresetsChange(folder, useCMakePresets))); - this.hideDebugButtonSub.set(folder, config.onChange('status', async (status: StatusConfig) => this.doStatusChange(folder, status))); + this.hideDebugButtonSub.set(folder, config.onChange('options', async (options: OptionConfig) => this.doStatusChange(folder, options))); } } this.afterAddFolderEmitter.fire({ folder: folder, projects: projects }); @@ -379,7 +379,7 @@ export class ProjectController implements vscode.Disposable { this.useCMakePresetsSub.delete(folder); } - private async doSourceDirectoryChange(folder: vscode.WorkspaceFolder, value: string | string[], status: StatusConfig) { + private async doSourceDirectoryChange(folder: vscode.WorkspaceFolder, value: string | string[], options: OptionConfig) { let sourceDirectories: string[] = []; if (typeof (value) === 'string') { sourceDirectories = [value]; @@ -416,7 +416,7 @@ export class ProjectController implements vscode.Disposable { for (let i = 0; i < sourceDirectories.length; i++) { const cmakeProject: CMakeProject = await CMakeProject.create(workspaceContext, sourceDirectories[i], this, sourceDirectories.length > 1); if (activeProjectPath === cmakeProject.sourceDir) { - await this.setActiveProject(cmakeProject, status); + await this.setActiveProject(cmakeProject, options); activeProjectPath = undefined; } @@ -426,7 +426,7 @@ export class ProjectController implements vscode.Disposable { if (activeProjectPath !== undefined) { // Active project is no longer available. Pick a different one. - await this.setActiveProject(projects.length > 0 ? projects[0] : undefined, status); + await this.setActiveProject(projects.length > 0 ? projects[0] : undefined, options); } @@ -463,17 +463,17 @@ export class ProjectController implements vscode.Disposable { } } - private async doStatusChange(folder: vscode.WorkspaceFolder, status: StatusConfig): Promise { + private async doStatusChange(folder: vscode.WorkspaceFolder, options: OptionConfig): Promise { const projects: CMakeProject[] | undefined = this.getProjectsForWorkspaceFolder(folder); if (projects) { for (const project of projects) { - project.doStatusChange(status); + project.doStatusChange(options); } } - await this.projectStatus.doStatusChange(status); - await util.setContextValue(ext.hideBuildCommandKey, (status.advanced?.build?.statusBarVisibility === "hidden" && status?.advanced?.build?.projectStatusVisibility === "hidden") ? true : false); - await util.setContextValue(ext.hideDebugCommandKey, (status.advanced?.debug?.statusBarVisibility === "hidden" && status?.advanced?.debug?.projectStatusVisibility === "hidden") ? true : false); - await util.setContextValue(ext.hideLaunchCommandKey, (status.advanced?.launch?.statusBarVisibility === "hidden" && status?.advanced?.launch?.projectStatusVisibility === "hidden") ? true : false); + await this.projectStatus.doStatusChange(options); + await util.setContextValue(ext.hideBuildCommandKey, (options.advanced?.build?.statusBarVisibility === "hidden" && options?.advanced?.build?.projectStatusVisibility === "hidden") ? true : false); + await util.setContextValue(ext.hideDebugCommandKey, (options.advanced?.debug?.statusBarVisibility === "hidden" && options?.advanced?.debug?.projectStatusVisibility === "hidden") ? true : false); + await util.setContextValue(ext.hideLaunchCommandKey, (options.advanced?.launch?.statusBarVisibility === "hidden" && options?.advanced?.launch?.projectStatusVisibility === "hidden") ? true : false); } async hideBuildButton(isHidden: boolean) { diff --git a/src/projectStatus.ts b/src/projectStatus.ts index e8d2e9f8c..8b823379f 100644 --- a/src/projectStatus.ts +++ b/src/projectStatus.ts @@ -3,7 +3,7 @@ import * as nls from 'vscode-nls'; import CMakeProject from './cmakeProject'; import * as preset from './preset'; import { runCommand } from './util'; -import { StatusConfig } from './config'; +import { OptionConfig } from './config'; nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })(); const localize: nls.LocalizeFunc = nls.loadMessageBundle(); @@ -96,12 +96,12 @@ export class ProjectStatus { } async openVisibilitySettings(): Promise { - await vscode.commands.executeCommand('workbench.action.openSettingsJson', { revealSetting: { key: 'cmake.status.advanced' }}); + await vscode.commands.executeCommand('workbench.action.openSettingsJson', { revealSetting: { key: 'cmake.options.advanced' }}); } - async updateActiveProject(cmakeProject?: CMakeProject, status?: StatusConfig): Promise { + async updateActiveProject(cmakeProject?: CMakeProject, options?: OptionConfig): Promise { // Update Active Project - await treeDataProvider.updateActiveProject(cmakeProject, status); + await treeDataProvider.updateActiveProject(cmakeProject, options); } refresh(node?: Node): Promise { @@ -133,8 +133,8 @@ export class ProjectStatus { await treeDataProvider.setIsBusy(isBusy); } - async doStatusChange(status: StatusConfig) { - await treeDataProvider.doStatusChange(status); + async doStatusChange(options: OptionConfig) { + await treeDataProvider.doStatusChange(options); } } @@ -164,11 +164,11 @@ class TreeDataProvider implements vscode.TreeDataProvider, vscode.Disposab return this.activeCMakeProject; } - async updateActiveProject(cmakeProject?: CMakeProject, status?: StatusConfig): Promise { + async updateActiveProject(cmakeProject?: CMakeProject, options?: OptionConfig): Promise { // Use project to create the tree if (cmakeProject) { this.activeCMakeProject = cmakeProject; - await this.doStatusChange(status); + await this.doStatusChange(options); } else { this.isConfigButtonHidden = false; this.isFolderButtonHidden = false; @@ -261,35 +261,35 @@ class TreeDataProvider implements vscode.TreeDataProvider, vscode.Disposab } // TODO: get rid of undefined? - public async doStatusChange(status: StatusConfig | undefined) { + public async doStatusChange(options: OptionConfig | undefined) { let didChange: boolean = false; if (this.activeCMakeProject) { - const folderVisibility = status?.advanced?.folder?.projectStatusVisibility !== "hidden"; + const folderVisibility = options?.advanced?.folder?.projectStatusVisibility !== "hidden"; if (folderVisibility === this.isFolderButtonHidden) { didChange = true; this.isFolderButtonHidden = !folderVisibility; } - const configureVisibility = status?.advanced?.configure?.projectStatusVisibility !== "hidden"; + const configureVisibility = options?.advanced?.configure?.projectStatusVisibility !== "hidden"; if (configureVisibility === this.isConfigButtonHidden) { didChange = true; this.isConfigButtonHidden = !configureVisibility; } - const buildVisibility = status?.advanced?.build?.projectStatusVisibility !== "hidden"; + const buildVisibility = options?.advanced?.build?.projectStatusVisibility !== "hidden"; if (buildVisibility === this.isBuildButtonHidden) { didChange = true; this.isBuildButtonHidden = !buildVisibility; } - const testVisibility = status?.advanced?.ctest?.projectStatusVisibility !== "hidden"; + const testVisibility = options?.advanced?.ctest?.projectStatusVisibility !== "hidden"; if (testVisibility === this.isTestButtonHidden) { didChange = true; this.isTestButtonHidden = !testVisibility; } - const debugVisibility = status?.advanced?.debug?.projectStatusVisibility !== "hidden"; + const debugVisibility = options?.advanced?.debug?.projectStatusVisibility !== "hidden"; if (debugVisibility === this.isDebugButtonHidden) { didChange = true; this.isDebugButtonHidden = !debugVisibility; } - const launchVisibility = status?.advanced?.launch?.projectStatusVisibility !== "hidden"; + const launchVisibility = options?.advanced?.launch?.projectStatusVisibility !== "hidden"; if (launchVisibility === this.isLaunchButtonHidden) { didChange = true; this.isLaunchButtonHidden = !launchVisibility; diff --git a/src/status.ts b/src/status.ts index 2d1251179..c0faa4ae5 100644 --- a/src/status.ts +++ b/src/status.ts @@ -1,4 +1,4 @@ -import { ConfigurationReader, StatusBarButtonVisibility, StatusBarTextButtonVisibility, StatusBarStaticButtonVisibility, StatusBarIconButtonVisibility } from '@cmt/config'; +import { ConfigurationReader, StatusBarOptionVisibility, StatusBarTextOptionVisibility, StatusBarStaticOptionVisibility, StatusBarIconOptionVisibility } from '@cmt/config'; import { SpecialKits } from '@cmt/kit'; import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; @@ -131,11 +131,11 @@ abstract class Button { private _isVisible(): boolean { return this.isVisible() && this._getVisibilitySetting() !== 'hidden'; } - private _getVisibilitySetting(): StatusBarButtonVisibility | StatusBarTextButtonVisibility | StatusBarStaticButtonVisibility | StatusBarIconButtonVisibility | null { + private _getVisibilitySetting(): StatusBarOptionVisibility | StatusBarTextOptionVisibility | StatusBarStaticOptionVisibility | StatusBarIconOptionVisibility | null { if (this.settingsName) { - let setting = Object(this.config.status.advanced)[this.settingsName]?.statusBarVisibility; + let setting = Object(this.config.options.advanced)[this.settingsName]?.statusBarVisibility; if (setting === undefined) { - setting = this.config.status.statusBarVisibility; + setting = this.config.options.statusBarVisibility; } return setting || null; } @@ -209,7 +209,7 @@ class FolderButton extends Button { return this.tooltip; } protected getTextShort(): string { - let len = this.config.status.advanced?.folder?.statusBarLength || 0; + let len = this.config.options.advanced?.folder?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -290,7 +290,7 @@ class KitSelection extends Button { } protected getTextShort(): string { - let len = this.config.status.advanced?.kit?.statusBarLength || 0; + let len = this.config.options.advanced?.kit?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -322,7 +322,7 @@ class BuildTargetSelectionButton extends Button { } protected getTextShort(): string { - let len = this.config.status.advanced?.buildTarget?.statusBarLength || 0; + let len = this.config.options.advanced?.buildTarget?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -354,7 +354,7 @@ class LaunchTargetSelectionButton extends Button { } protected getTextShort(): string { - let len = this.config.status.advanced?.launchTarget?.statusBarLength || 0; + let len = this.config.options.advanced?.launchTarget?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -439,7 +439,7 @@ class CTestButton extends Button { update(): void { this.icon = 'beaker'; - if (this.config.status.advanced?.ctest?.color === true) { + if (this.config.options.advanced?.ctest?.color === true) { this.button.color = this._color; } else { this.button.color = ''; @@ -457,7 +457,7 @@ class CTestButton extends Button { } protected getTextShort(): string { - let len = this.config.status.advanced?.ctest?.statusBarLength || 0; + let len = this.config.options.advanced?.ctest?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -549,7 +549,7 @@ export class ConfigurePresetSelection extends Button { } protected getTextShort(): string { - let len = this.config.status.advanced?.configurePreset?.statusBarLength || 0; + let len = this.config.options.advanced?.configurePreset?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -592,7 +592,7 @@ export class BuildPresetSelection extends Button { } protected getTextShort(): string { - let len = this.config.status.advanced?.buildPreset?.statusBarLength || 0; + let len = this.config.options.advanced?.buildPreset?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -635,7 +635,7 @@ export class TestPresetSelection extends Button { } protected getTextShort(): string { - let len = this.config.status.advanced?.testPreset?.statusBarLength || 0; + let len = this.config.options.advanced?.testPreset?.statusBarLength || 0; if (!Number.isInteger(len) || len <= 0) { len = 20; } @@ -692,7 +692,7 @@ export class StatusBar implements vscode.Disposable { this._buildPresetButton, this._testPresetButton ]; - this._config.onChange('status', () => this.update()); + this._config.onChange('options', () => this.update()); this.update(); } diff --git a/test/unit-tests/config.test.ts b/test/unit-tests/config.test.ts index 40113ecc7..84d73c876 100644 --- a/test/unit-tests/config.test.ts +++ b/test/unit-tests/config.test.ts @@ -58,7 +58,7 @@ function createConfig(conf: Partial): Configurat visibility: "default" }, showOptionsMovedNotification: true, - status: { + options: { advanced: {}, statusBarVisibility: "visible" },