Skip to content

Commit

Permalink
added button to open extension setting from project status view (and …
Browse files Browse the repository at this point in the history
…can be called from command palette)
  • Loading branch information
snehara99 committed Oct 23, 2023
1 parent ad26aa0 commit 4715c5c
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 0 deletions.
32 changes: 32 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,16 @@
"light": "res/light/clean-configure-icon.svg"
}
},
{
"command": "cmake.projectStatus.openSettings",
"title": "%cmake-tools.command.cmake.openSettings.title%",
"when": "cmake:enableFullFeatureSet",
"category": "CMake",
"icon": {
"dark": "res/dark/settings-icon.svg",
"light": "res/light/settings-icon.svg"
}
},
{
"command": "cmake.cleanConfigureWithDebugger",
"title": "%cmake-tools.command.cmake.cleanConfigureWithDebugger.title%",
Expand Down Expand Up @@ -656,6 +666,11 @@
"title": "%cmake-tools.command.cmake.resetState.title%",
"category": "CMake"
},
{
"command": "cmake.openSettings",
"title": "%cmake-tools.command.cmake.openSettings.title%",
"category": "CMake"
},
{
"command": "cmake.outline.runUtilityTarget",
"when": "cmake:enableFullFeatureSet",
Expand Down Expand Up @@ -1001,6 +1016,9 @@
{
"command": "cmake.resetState"
},
{
"command": "cmake.openSettings"
},
{
"command": "cmake.configureAll",
"when": "cmake:multiProject"
Expand Down Expand Up @@ -1260,6 +1278,10 @@
"command": "cmake.projectStatus.cleanConfigure",
"when": "never"
},
{
"command": "cmake.projectStatus.openSettings",
"when": "never"
},
{
"command": "cmake.projectStatus.setVariant",
"when": "never"
Expand Down Expand Up @@ -1331,6 +1353,11 @@
"when": "view == cmake.projectStatus && !cmake:isBuilding && !cmake:hideLaunchCommand && cmake:enableFullFeatureSet",
"group": "navigation@4"
},
{
"command": "cmake.projectStatus.openSettings",
"when": "view == cmake.projectStatus && cmake:enableFullFeatureSet",
"group": "navigation@5"
},
{
"command": "cmake.outline.configureAll",
"when": "view == cmake.outline && !cmake:isBuilding",
Expand Down Expand Up @@ -1398,6 +1425,11 @@
"when": "view == cmake.projectStatus && cmake:enableFullFeatureSet && viewItem == 'cleanConfigure'",
"group": "inline"
},
{
"command": "cmake.projectStatus.openSettings",
"when": "view == cmake.projectStatus && cmake:enableFullFeatureSet && viewItem == 'openSettings'",
"group": "inline"
},
{
"command": "cmake.projectStatus.setVariant",
"when": "view == cmake.projectStatus && cmake:enableFullFeatureSet && viewItem == 'variant'",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"cmake-tools.command.cmake.stop.title": "Cancel Build",
"cmake-tools.command.cmake.stopAll.title": "Cancel Build for All Projects",
"cmake-tools.command.cmake.resetState.title": "Reset CMake Tools Extension State (For troubleshooting)",
"cmake-tools.command.cmake.openSettings.title": "Open CMake Tools Extension Settings",
"cmake-tools.command.cmake.selectActiveFolder.title": "Select Active Folder",
"cmake-tools.command.cmake.outline.runUtilityTarget.title": "Run Utility",
"cmake-tools.command.cmake.outline.debugTarget.title": "Debug",
Expand Down
12 changes: 12 additions & 0 deletions res/dark/settings-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions res/light/settings-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,10 @@ export class ExtensionManager implements vscode.Disposable {
void vscode.commands.executeCommand('workbench.action.reloadWindow');
}

async openSettings() {
void vscode.commands.executeCommand('workbench.action.openSettings', '@ext:ms-vscode.cmake-tools');
}

async viewLog() {
telemetry.logEvent("openLogFile");
await logging.showLogFile();
Expand Down Expand Up @@ -1840,6 +1844,7 @@ async function setup(context: vscode.ExtensionContext, progress?: ProgressHandle
'selectLaunchTarget',
'setDefaultTarget',
'resetState',
'openSettings',
'viewLog',
'logDiagnostics',
'compileFile',
Expand Down
3 changes: 3 additions & 0 deletions src/projectStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ export class ProjectStatus {
await runCommand('cleanConfigure');
await this.refresh();
}),
vscode.commands.registerCommand('cmake.projectStatus.openSettings', async(_node: Node) => {
await runCommand('openSettings');
}),
vscode.commands.registerCommand('cmake.projectStatus.selectKit', async (_node: Node) => {
await runCommand('selectKit');
await this.refresh();
Expand Down

0 comments on commit 4715c5c

Please sign in to comment.