Skip to content

Commit

Permalink
debug-only extension point
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jul 29, 2024
1 parent cf08702 commit 98557d7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
6 changes: 6 additions & 0 deletions extensions/emmet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@
}
],
"menus": {
"viewContainer/title": [
{
"command": "workbench.action.chat.newChat",
"group": "navigation"
}
],
"commandPalette": [
{
"command": "editor.emmet.action.wrapWithAbbreviation",
Expand Down
8 changes: 8 additions & 0 deletions extensions/r/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
},
"categories": ["Programming Languages"],
"contributes": {
"menus": {
"viewContainer/title": [
{
"command": "workbench.action.chat.newChat",
"group": "navigation"
}
]
},
"languages": [
{
"id": "r",
Expand Down
18 changes: 17 additions & 1 deletion src/vs/workbench/services/actions/common/menusExtensionPoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1035,13 +1035,29 @@ menusExtensionPoint.setHandler(extensions => {
}
}

item.when = ContextKeyExpr.deserialize(menuItem.when);
const when = menu.id === MenuId.ViewContainerTitle ?
// ensureDebugViewletOnly(menuItem.when) :
menuItem.when :
menuItem.when;

item.when = ContextKeyExpr.deserialize(when);
_menuRegistrations.add(MenuRegistry.appendMenuItem(menu.id, item));
}
}
}
});

function ensureDebugViewletOnly(when: string | undefined): string {
if (!when) {
return 'viewContainer == workbench.view.debug';
}

// This is not perfect, but just communicates that this is intended for debug viewlet only for now as a proposal
return when.includes('viewContainer == workbench.view.debug') ?
when :
`${when} && viewContainer == workbench.view.debug`;
}

class CommandsTableRenderer extends Disposable implements IExtensionFeatureTableRenderer {

readonly type = 'table';
Expand Down

0 comments on commit 98557d7

Please sign in to comment.