Skip to content

revealFileInOS may ignore the passed URI or pick additional URIs from Explorer selection depending on UI state #331687

Description

@n-gist

During extension development, an issue was encountered where commands.executeCommand('revealFileInOS', uri) may ignore the passed URI and use the current Explorer selection instead. For example: (1) an item is selected in the Explorer view, and (2) the command is invoked without switching to another view/editor, by using an extension tree view title context menu.

In general, the provided URI argument is ignored when the Explorer View is focused, has a selection, and the provided URI is not part of that selection.

According to discussions in issues such as #110869 and #232522, revealFileInOS appears to be an internal command tied to the Explorer view, and extensions may be expected to implement their own revealing approach.

However, the following code was found to use revealFileInOS with an explicit URI, relying on it to reveal the specified resource:

These consumers may reveal incorrect paths if an unrelated item is selected in the Explorer during execution.

It seems that one of the following approaches may be needed:

  • Fix revealFileInOS (getMultiSelectedResources) so an explicitly passed URI is always respected, while preserving the existing multi-selection behavior where needed.
  • Change the listed consumers to avoid revealFileInOS and instead use a revealing mechanism that operates directly on the specified URI.
  • Introduce a separate command for revealing explicitly specified URIs that is independent of Explorer selection and view focus state, also accessible by extensions.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions