Skip to content

Commit

Permalink
add button to menuconfig tree to open it in terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
Viperinius committed Sep 12, 2023
1 parent 602e7b3 commit fbd3a7a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
"command": "vscode-ptxdist.selectToolchain",
"title": "Select a toolchain"
},
{
"command": "vscode-ptxdist.callMenuConfig",
"title": "Call 'ptxdist menuconfig'",
"icon": "$(console)"
},
{
"command": "vscode-ptxdist.refreshConfigs",
"title": "Refresh available configs",
Expand Down Expand Up @@ -231,6 +236,11 @@
{
"command": "vscode-ptxdist.ptxcmd-addPreset",
"when": "view == ptxdist-commands && viewItem == isCmdWithPreset"
},
{
"command": "vscode-ptxdist.callMenuConfig",
"when": "view == ptxdist-general-config && viewItem == menuConfig",
"group": "inline"
}
]
},
Expand Down
5 changes: 5 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ export function activate(context: vscode.ExtensionContext) {

context.subscriptions.push(vscode.commands.registerCommand('vscode-ptxdist.refreshConfigs', () => ptxGeneralConfigProvider.refresh([])));

context.subscriptions.push(vscode.commands.registerCommand('vscode-ptxdist.callMenuConfig', async () => {
//vscode.commands.executeCommand('workbench.action.toggleMaximizedPanel');
await ptxInteraction.ptxdistOpenMenuconfig(workspaceRootPath);
}));

context.subscriptions.push(vscode.commands.registerCommand('vscode-ptxdist.printWorkspaceRoot', async () => {
let cmd: string = '';
if (workspaceRootPath !== '') {
Expand Down
9 changes: 7 additions & 2 deletions src/ptxGeneralConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ export class PtxGeneralConfigProvider implements vscode.TreeDataProvider<PtxGenC
'',
'',
"menuConfig",
vscode.TreeItemCollapsibleState.Expanded),
vscode.TreeItemCollapsibleState.Expanded,
undefined,
undefined,
undefined,
"menuConfig"),
new PtxGenConfig(
"Platformconfig",
'',
Expand Down Expand Up @@ -111,7 +115,8 @@ export class PtxGeneralConfigProvider implements vscode.TreeDataProvider<PtxGenC
vscode.TreeItemCollapsibleState.None,
'vscode-ptxdist.selectPtxConfig',
m === selMenuconfig ? 'issue-closed' : 'issue-draft',
m === selMenuconfig ? new vscode.ThemeColor('testing.iconPassed') : undefined
m === selMenuconfig ? new vscode.ThemeColor('testing.iconPassed') : undefined,
m === selMenuconfig ? "menuConfig" : undefined
));
});

Expand Down
18 changes: 6 additions & 12 deletions src/util/ptxInteraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,18 @@ export async function ptxdistToolchain(workspaceRootPath: string, pathToToolchai
}
}

export async function ptxdistClean(workspaceRootPath: string, all: boolean, packages?: string[]): Promise<void> {
export async function ptxdistOpenMenuconfig(workspaceRootPath: string) {
if (currentOsPlatform !== OsPlatform.linux) {
return;
}
let cmd: string = '';
}

let cmd: string = '';
if (workspaceRootPath.includes('ptxproj')) {
cmd += 'cd ' + workspaceRootPath + ' && ';
}
else {
cmd += 'cd ' + workspaceRootPath + '/ptxproj/ && ';
}
cmd += 'yes | ptxdist clean ';
if (!all) {
if (packages === undefined || packages.length === 0) {
return;
}
cmd += packages.join(' ');
}
runInTerminal('PTXdist', cmd, true);
cmd += 'ptxdist menuconfig';
return runInTerminal('PTXdist', cmd, true, true);
}

0 comments on commit fbd3a7a

Please sign in to comment.