Skip to content

Add Copy Path to editor tab context menu - #8737

Merged
gtritchie merged 8 commits into
v1.4-juliet-rosefrom
feature/copy-doc-path
Jan 14, 2021
Merged

gtritchie merged 8 commits into
v1.4-juliet-rosefrom
feature/copy-doc-path

Conversation

@gtritchie

@gtritchie gtritchie commented Jan 14, 2021 •

Copy link
Copy Markdown
Member

Intent

  • Fixes Copy script path from tabs  #7289
  • IDE's typically have a way to copy the path of an open file via context menu, now we do, too
    screenshot of document tab context menu showing new Copy Path command
  • Also added to command palette as "Copy Document Path" for keyboard-only use

Approach

  • Went for simplest approach, just copy the entire path, including filename, to the clipboard
  • On Windows Desktop, a leading ~ will be resolved to a full path, since this isn't a native concept on Windows, but on Server, other desktop platforms, and RDP remote sessions, the ~ will be left as-is

QA Notes

  • Test in source columns and in popped-out satellite source editors using both Command Palette and tab context menu
  • Test in a variety of browsers; the code I'm using for copying came from stackoverflow and seems to cover all major browsers we support in my testing, but it's possible we might find some edge cases (if so, we could consider using clipboard.js, instead)
  • I expect people will request variations on this, e.g. just copy the filename, just copy the path without the filename, resolve the entire path on all platforms, etc., but just getting in the basic functionality for v1.4-juliet-rose

- Puts document path (including filename) on the clipboard
- Fixes #7289
- Doesn't resolve relative paths (including ~ on Posix), just puts exactly what's in the tab tooltip on the clipboard
- allows use via keyboard (command palette)
- moved event handler so it works in both main window and satellite windows

@jmcphers jmcphers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is a great improvement!

@gtritchie
gtritchie merged commit 39ff318 into v1.4-juliet-rose Jan 14, 2021
@gtritchie
gtritchie deleted the feature/copy-doc-path branch April 6, 2021 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants