Skip to content

Copy Path and Copy Relative Path commands are only available when editor is not focused. #137216

Closed
@a-stewart

Description

@a-stewart

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.62.1
  • OS Version: Mac OS 11.6

Steps to Reproduce:

  1. Open a file
  2. Right click on the file tab, there is a copy file command and a keybinding to use it
  3. Try and use the suggested keybinding (cmd + alt + c) (whilst the editor is focused)
  4. Nothing is added to the clipboard and nothing is shown to the user explaning why.

I would expect the path to be copied to clipboard but it isn't.

The when clauses in this file, specify that the keybinding is only active when the editor is not focused.
https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/files/browser/fileCommands.ts#L293-L319

I did some digging to see when that when clause was added and found this:

Related change: c88e58f
Which fixed bug: #47947

The find widget has 3 toggles:

  • match case - cmd+alt+C
  • match whole word - cmd+alt+W
  • use regular expression - cmd+alt+R

From those 3 there are 2 commands which now overwrite :

  • revealFileInOS steals cmd+alt+R
  • copyFilePath steals cmd+alt+C

@isidorn Please leave cmd+alt+R and cmd+alt+C for the find widget toggles when focus is in the editor.

Originally posted by @alexdima in #47947 (comment)

It looks like the exclusion is correct, but it is a bit confusing for a user as when you right click on a tab, you are shown a command to copy the relative path, but then when you try and use it, it doesn't work. (Editor being focused is probably the most common use case in vscode.)

As an alternative suggestion, perhaps we could use !findWidgetVisible as the when clause instead - that would avoid conflicting with the find widget commands but would allow the command to be used in the editor.

It also has the advantage that something would always happen, either the path would be copied, or the icon in the find widget would change.

I have created a draft CL with a change that would potentially improve this.

WDYT?

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugverifiedVerification succeededworkbench-tabsVS Code editor tab issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions