Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

t9md
Copy link
Contributor

@t9md t9md commented Dec 3, 2017

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 copy displayName or name of selected item to clipboard.

    • enabled when allowCoreCopyWithEmptySelectionCopySelectedItemText is set to display-name or command-name.

    • GIF: core:copy(cmd-c) copy displayName of selected item when mini-editor's selection was empty
      copy-command2

  • Copy name and displayName from contextMenu

    • command-palette:copy-display-name-from-context-menu: copy displayName of command to clipboard.

    • command-palette:copy-command-name-from-context-menu: copy name of command to clipboard.

    • GIF: can copy item text from contextMenu
      copy-command

  • Copy name and displayName from keyboard shortcut(no default keymap, but usable if user set it in their keymap.cson)

    • command-palette:copy-display-name: copy displayName of command to clipboard.
    • command-palette:copy-command-name: copy name 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.

keymap_cson_ ____atom

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's keymap.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.

  • displayName is useful when writing documentation, guiding user to invoke command from command-palette(e.g. issue response).
  • name is useful to copy precise command name to paste to user's keymap.cson, hopefully reduce lots of typo issue, new user easily can get correct command name.

Possible Drawbacks

None.

Applicable Issues

No.

@t9md t9md force-pushed the copy-command-name branch 3 times, most recently from 8fa4f6f to 3742526 Compare December 4, 2017 03:04
@t9md t9md force-pushed the copy-command-name branch from 3742526 to 8d77995 Compare March 28, 2018 09:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant