Conversation
packages/plugin-ext/src/main/browser/menus/menus-contribution-handler.ts
Outdated
Show resolved
Hide resolved
| command: string; | ||
| title: string; | ||
| category?: string; | ||
| icon?: string | { light: string; dark: string; }; |
There was a problem hiding this comment.
hello again: why here do we have icon light and icon dark ?
There was a problem hiding this comment.
Should we ignore and don't parse from package.json? https://github.com/Microsoft/vscode/blob/366bfe96bf2fe4cff37de895c3fa2ccb776eb621/extensions/markdown-language-features/package.json#L29-L36
What is your suggestion?
There was a problem hiding this comment.
hello, my question is why it's not IconUrl that you introduced there
export type IconUrl = string | { light: string; dark: string; };
There was a problem hiding this comment.
PluginPackageCommand is a format of raw command as it is defined by VS Code, with relative paths for icons. In order to download them, paths are converted into URLs served by hostedPlugin entry point. A new type is introduced to make it clear that a string is a url, not a raw path.
There was a problem hiding this comment.
shouldn't be then URI instead of string for iconUrl ?
There was a problem hiding this comment.
I thought about it, but then we need to transfer such urls from backend to frontend, and decided to stick with strings as for other remote APIs.
05e62e2 to
4f5e0ef
Compare
| execute: (...args: any[]) => { | ||
| this.proxy.$executeCommand(command.id, ...args); | ||
| // plugin command handlers cannot handle Theia URI, only VS Code URI | ||
| const resolvedArgs = (args || []).map(arg => arg instanceof URI ? arg['codeUri'] : arg); |
There was a problem hiding this comment.
There was a problem hiding this comment.
looks like there is something not so neat around URI. AFAIK consumer should just use the object
There was a problem hiding this comment.
it's not conflicting with https://github.com/theia-ide/theia/blob/master/packages/plugin-ext-vscode/src/browser/plugin-vscode-commands-contribution.ts#L46 ?
I don't think so. vscode.open is called by a plugin, so URI should be converted from VS Code to Theia format.
I'm trying to handle the reverse case: when Theia calls a plugin command. In this case, plugin command handlers expect only URIs in VS Code format, so Theia URIs should be always converted.
Does it make sense? Do you know the better place for conversion?
There was a problem hiding this comment.
thx @akosyakov for the reply. The location of the convert is still looking strange to me here.
AFAIK If someone is calling a plug-in then this is that part that need to convert to theia URI format, not theia plug-in checking if format that it is receiving is in a vscode format.
I'm afraid that we miss several converters. Here it is for Uri but what if there is another type, etc.
should it be inside RPC ? or is it mangled there https://github.com/theia-ide/theia/pull/4062/files
There was a problem hiding this comment.
AFAIK If someone is calling a plug-in then this is that part that need to convert to theia URI format, not theia plug-in checking if format that it is receiving is in a vscode format.
The core does not know that it calls a plug-in, it calls a menu command handler and pass URI of a selected resource to it. Usually it is fine. With plugin-in it is not, because they cannot handle such URIs.
There was a problem hiding this comment.
Code in command-registry-main is a menu command handler from plugin-ins. Could you be more specific and suggest where it should be done if not here?
There was a problem hiding this comment.
Do you suggest to register a synthetic command for menu items that translates URIs and then delegate to a plugin-in command handler?
There was a problem hiding this comment.
do you have an example of failing test for this usecase ?
is it only for vs code extensions or for theia plug-ins ?
There was a problem hiding this comment.
ok, moved to menus-contribution-handler: https://github.com/theia-ide/theia/pull/4173/files#diff-c111d7d3381b06ddff0ddb201236bec1
|
@azatsarynnyy mentioned that there are duplicate menu items with these changes, for example for https://github.com/Azure/vscode-kubernetes-tools/blob/master/package.json#L579-L588 even though |
|
@azatsarynnyy could you try again, i've removed a limitation to have only one menu item per a command. Since we have different contexts it does not make sense: 265c0e0 |
|
@akosyakov I've tested the PR with the latest version of the vscode k8s extension and it works well. I see no issues. |
265c0e0 to
3aaa72b
Compare
|
@svor Could you check please that registering code lenses from the vscode extensions still work? |
3aaa72b to
1eee41e
Compare
svor
left a comment
There was a problem hiding this comment.
Tested with vscode java extension 0.37.0 and it works without unexpected problems
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
…rent contexts Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
1eee41e to
e5c8ff9
Compare
|
Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
| # Change Log | ||
|
|
||
| ## v0.3.20 | ||
| ## v0.4.0 |
fix #4004
VS Code docs: https://code.visualstudio.com/api/references/contribution-points#contributes.menus
This PR alignes Theia menus with VS Code built-in menus:
navigatormenu group is always sorted to the topexplorer/contexteditor/contexteditor/titledebug/callstack/contextview/item/contextOut of scope, since there are not corresponding implementations in Theia:
editor/title/contextmenu: [tabbar-toolbar] support context menus #4161view/titlesupport view title menu contributions #4174ALTcommands [menus] alternative command support #4162Testing:
One can test against this VS Code extension: https://github.com/akosyakov/vscode-menus
There is no API breaking changes, but menu constants were renamed. Is it a case for major release? @marcdumais-work @svenefftinge
Location of built-in explorer groups in Theia and VS Code:
