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.
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,
revealFileInOSappears 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
revealFileInOSwith 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:
revealFileInOS(getMultiSelectedResources) so an explicitly passed URI is always respected, while preserving the existing multi-selection behavior where needed.revealFileInOSand instead use a revealing mechanism that operates directly on the specified URI.