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:

image

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 like resource 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

Most upvoted comments

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.