vscode: Resolve the conflict run button in editor context menu
Problem
Since the contribution point: editor/title
is open for all the extensions, sometimes different extensions may have conflicts at this area. For example, in Java, such conflicts affect the run experience when the user installs both the Java extensions and the Code Runner extension:
This is a very open and big topic, as a author of VS Code extensions, it will be great if VS Code as a platform, can provide solutions for this issue.
Potential Solutions
Below are just rough ideas on this, it’s open for discussion!
Editor Metadata
Extensions can register context value per document/editor, and register command on the editor title area according to the context value. For example. the Java Debugger can use this to mark if the current Java file is executable or not. And register the run/debug command into the editor context area if it’s executable.
This can somehow achieved by using the
in
expression of the when clause, something likeresource in hasMainMethodFiles
. But we also need to get the context value dynamically from the code to handle with the corporation between multiple extensions.
Meanwhile the Java feature team can contribute changes to the Code Runner extension to align the UX (for example, hide the run button from Code Runner if the current Java file contains an executable Main class).
Official Support for the run experience in the editor title area.
This also may have some opportunity since I believe it’s somehow related with #85759, if VS Code team will consider provide official run/debug
functionality area in the editor title.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 20 (20 by maintainers)
Commits related to this issue
- extract menu entry view item creation logic, fyi @joaomoreno prep for https://github.com/microsoft/vscode/issues/114123 — committed to microsoft/vscode by jrieken 3 years ago
- only ask to inline when there would be enough space, https://github.com/microsoft/vscode/issues/114123 — committed to microsoft/vscode by jrieken 3 years ago
- position run-submenu further to the left, https://github.com/microsoft/vscode/issues/114123 — committed to microsoft/vscode by jrieken 3 years ago
- news https://github.com/microsoft/vscode/issues/114123 — committed to microsoft/vscode-docs by jrieken 3 years ago
- Squashed 'lib/vscode/' changes from 3e344b17b7b..622cb03f7e0 622cb03f7e0 Merge pull request #116444 from microsoft/alex/stable-fix-116060 5933e313e5d Fixes #116060: Clone minimap options before chang... — committed to coder/code-server by jsjoeio 3 years ago
- Squashed 'lib/vscode/' changes from 622cb03f7e0..305bf142199 305bf142199 Remove icon from input row in ports view (#118649) b5af426d34c Properly dispose everything in tunnel view cells (#118546) f299... — committed to coder/code-server by jsjoeio 3 years ago
- Squashed 'lib/vscode/' changes from 622cb03f7e0..fd6f3bce670 fd6f3bce670 chore: bump electron@11.3.0 (#118680) 305bf142199 Remove icon from input row in ports view (#118649) b5af426d34c Properly disp... — committed to coder/code-server by jsjoeio 3 years ago
- Squashed 'lib/vscode/' changes from 622cb03f7e0..fd6f3bce670 fd6f3bce670 chore: bump electron@11.3.0 (#118680) 305bf142199 Remove icon from input row in ports view (#118649) b5af426d34c Properly disp... — committed to coder/code-server by jsjoeio 3 years ago
This will be available to all extensions via the
editor/title/run
-menu@brettcannon you would still be able to do that but we ask you to contribute into the new submenu instead of the editor title menu
From where I stand this looks like a feature for “Run & Debug”, e.g not only have those commands in the views but also in editor titles. Tho, it would still mean that you have multiple “runners”, just behind a nice UI.