This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Copy command's displayName and name from contextMenu + keyboard shortcut #102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Change
Short summary
Copy display name(
Applicatoin: About
) and command name(application:about
) from contextMenu and also from keyboard shortcut.As a package author(and maintainer), I frequently need to copy exact command name when writing document, responding issue to instruct user to execute certain command.
This PR reduces workload to copy command.
Also reduces typo-issue when customizing their
keymap.cson
.Summary of changes
When
command-palette
's mini editor have no selected text,core:copy
copydisplayName
orname
of selected item to clipboard.enabled when
allowCoreCopyWithEmptySelectionCopySelectedItemText
is set todisplay-name
orcommand-name
.GIF:

core:copy
(cmd-c
) copydisplayName
of selected item when mini-editor's selection was emptyCopy
name
anddisplayName
from contextMenucommand-palette:copy-display-name-from-context-menu
: copydisplayName
of command to clipboard.command-palette:copy-command-name-from-context-menu
: copyname
of command to clipboard.GIF: can copy item text from contextMenu

Copy
name
anddisplayName
from keyboard shortcut(no default keymap, but usable if user set it in theirkeymap.cson
)command-palette:copy-display-name
: copydisplayName
of command to clipboard.command-palette:copy-command-name
: copyname
of command to clipboard.Optionally surround by backtick
User can auto-surround by backtick when copying by enabling following configuration(disabled by default).
surroundByBackTickWhenCopyCommandName
surroundByBackTickWhenCopyDisplayName
Alternate Designs
Share or not-share command for keyborad-shortcut and contextMenu
I consider two approach for how to define command for keyborad shortcut and for contextMenu.
A. share command for keyboard shortcut and contextMenu
Define following only two commands
command-palette:copy-display-name
command-palette:copy-command-name
Then differentiate behavior by determining whether it invoked from contextMenu or not.
Pros. concise
Cons. When user set keyboard shortcut in their
keymap.cson
. contexMenu shows shortcut, but it actually behave differently when invoked from shortcut or when invoked from contextMenu. It's confusing, misleading.B. share command for keyboard shortcut and contextMenu
Define following four command, two for invocation from keyboard, two for invocation from contextMenu.
command-palette:copy-display-name
command-palette:copy-display-name-from-context-menu
command-palette:copy-command-name
command-palette:copy-command-name-from-context-menu
Pros. No confusion/misleading like A.
Cons.
-from-context-menu
shortcut should not be used for user'skeymap.cson
, but it's responsible for user(cannot enforce it).Benefits
Can copy displayName(e.g.
Applicatoin: About
), name(e.g.application:about
) of command.keymap.cson
, hopefully reduce lots of typo issue, new user easily can get correct command name.Possible Drawbacks
None.
Applicable Issues
No.