Skip to content

Commit d1c68d3

Browse files
Copilotrijesha
andcommitted
Implement west config command with UI buttons and integration
Co-authored-by: rijesha <7819200+rijesha@users.noreply.github.com>
1 parent 5f00dc7 commit d1c68d3

File tree

5 files changed

+268
-63
lines changed

5 files changed

+268
-63
lines changed

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@
426426
{
427427
"command": "zephyr-ide.workspace-setup-standard",
428428
"title": "Zephyr IDE: Setup Standard Workspace"
429+
},
430+
{
431+
"command": "zephyr-ide.west-config",
432+
"title": "Zephyr IDE: West Config"
429433
}
430434
],
431435
"terminal": {

src/extension.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ import {
8989
workspaceSetupFromCurrentDirectory,
9090
workspaceSetupStandard,
9191
manageWorkspaces,
92+
westConfig,
9293
} from "./setup_utilities/workspace-setup";
9394
import {
9495
initializeDtsExt,
@@ -1325,6 +1326,13 @@ export async function activate(context: vscode.ExtensionContext) {
13251326
)
13261327
);
13271328

1329+
context.subscriptions.push(
1330+
vscode.commands.registerCommand("zephyr-ide.west-config", async () => {
1331+
await westConfig(context, wsConfig, globalConfig);
1332+
}
1333+
)
1334+
);
1335+
13281336
context.subscriptions.push(
13291337
vscode.commands.registerCommand("zephyr-ide.shell_test", async () => {
13301338
output.show();

src/panels/extension_setup_view/ExtensionSetupView.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ export class ExtensionSetupView implements vscode.WebviewViewProvider {
4646
},
4747
label: "Workspace Setup",
4848
value: { command: "zephyr-ide.workspace-setup-picker" },
49+
}, {
50+
icons: {
51+
leaf: 'settings',
52+
},
53+
label: "West Config",
54+
value: { command: "zephyr-ide.west-config" },
4955
}, {
5056
icons: {
5157
leaf: 'tools',

src/panels/setup_panel/SetupPanel.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ export class SetupPanel {
151151
case "workspaceSetupPicker":
152152
this.workspaceSetupPicker();
153153
return;
154+
case "westConfig":
155+
this.westConfig();
156+
return;
154157
}
155158
}
156159

@@ -294,6 +297,16 @@ export class SetupPanel {
294297
}
295298
}
296299

300+
private async westConfig() {
301+
try {
302+
vscode.commands.executeCommand("zephyr-ide.west-config");
303+
} catch (error) {
304+
vscode.window.showErrorMessage(
305+
`Failed to open west config: ${error}`
306+
);
307+
}
308+
}
309+
297310
private async listSDKs() {
298311
try {
299312
if (!this.currentWsConfig || !this.currentGlobalConfig) {
@@ -677,6 +690,7 @@ export class SetupPanel {
677690
<p style="margin-bottom: 20px; color: var(--vscode-descriptionForeground); font-size: 12px;">Open a folder in VS Code to begin configuring your Zephyr development environment.</p>
678691
<div style="display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;">
679692
<button class="button" onclick="workspaceSetupPicker()">Workspace Setup</button>
693+
<button class="button button-secondary" onclick="westConfig()">West Config</button>
680694
<button class="button button-secondary" onclick="openFolder()">Open Folder</button>
681695
</div>
682696
</div>`;
@@ -710,6 +724,8 @@ export class SetupPanel {
710724
clickHandler = "workspaceSetupStandard()";
711725
} else if (action === "current-directory") {
712726
clickHandler = "workspaceSetupFromCurrentDirectory()";
727+
} else if (action === "west-config") {
728+
clickHandler = "westConfig()";
713729
}
714730

715731
return `
@@ -754,6 +770,13 @@ export class SetupPanel {
754770
"Set up the current VS Code workspace directory for Zephyr development, preserving any existing files and configurations. Process goes through aiding a user choose a zephyr install.",
755771
"Existing projects, downloaded samples, or when you want to add quickly run projects with an external install.",
756772
"current-directory"
773+
)}
774+
${this.generateWorkspaceOptionCard(
775+
"⚙️",
776+
"West Configuration",
777+
"Configure west for the current workspace by detecting .west folders, west.yml files, or creating new west.yml from templates.",
778+
"Flexible workspace configuration when you need granular control over west setup.",
779+
"west-config"
757780
)}
758781
</div>`;
759782
}

0 commit comments

Comments
 (0)