vscode-macros icon indicating copy to clipboard operation
vscode-macros copied to clipboard

[feature] Show assigned Macro Name in command bar

Open WebMechanic opened this issue 3 years ago • 6 comments

Hello,

would it be possible to display the name assigned in the settings inside the command bar of VSC?

I'm referring to vscodemacros.userMacroCommands[0].name etc

"User Macro 01" to "User Macro 10" isn't very helpful if you don't use them often and they don't have a shortcut assigned to serve as a mnemonic. image

The list could then read:

  • VSCMacros 01: Pretty quotes
  • VSCMacros 02: Unbreakable
  • VSCMacros 03: . . .

This would also allow to type a macro name and run it from the list.

Thank you.

WebMechanic avatar Jan 29 '22 10:01 WebMechanic

@WebMechanic

Thanks for the suggestion. Unfortunately, as far as I know, the VSCode command name is fixed at package.json as follows.

https://github.com/exceedsystem/vscode-macros/blob/main/package.json

If you know of other VSCode extensions that allow you to set arbitrary command names, please let me know. I will consider it.

Regards.

exceedsystem avatar Jan 29 '22 10:01 exceedsystem

ah, that's unfortunate and explains the "random" amount of 10 user macros 😁 Thanks.

So I'm just wondering: how does translation / localisation of command titles then happen? or is this not a thing in VSCode? The actual command itself wouldn't change, just its label/title. If there isn't, there should be an API 🤔 -- MS can't be that ignorant on that subject 🙄

I typically write my code and use editors in English even if there's a localised version so I haven't checked for such version of Code (yet). I'll have a look then.

EDIT: that one was easily solved https://github.com/Microsoft/vscode-loc; now looking for an API and "misuse" of that at runtime ;-)

WebMechanic avatar Jan 29 '22 11:01 WebMechanic

Going the l10n route ...

Could adding (a custom) package.*.nls.json to the install folder "after the fact" be feasible? mentioned here: https://github.com/microsoft/vscode/issues/125774

also:

  • MS's vscode-nls on github
  • MS's vscode-nls-dev
  • https://marketplace.visualstudio.com/items?itemName=JarrettSpiker.vscode-extension-localization-helper

WebMechanic avatar Jan 29 '22 11:01 WebMechanic

@WebMechanic

Thanks for the information.

However, I'm not keen on using a nls feature that is not intended to be used to achieve this, as it is a forced response. I will consider if there is a way to dynamically set arbitrary command titles via API calls. (also need to consider that VSCode Macros supports older versions of VSCode.)

exceedsystem avatar Jan 29 '22 23:01 exceedsystem

well, I believe it's exactly the right feature to do the job: translate generic keys (placeholders) into something the user can easily understand and therefor enhances usability. If there are all 10 macros defined, it's hard to remember which one does what w/o a proper label, given people tend to use more than one program that all come with keyboard shortcuts; that's mental overload :-)

but get your point.

WebMechanic avatar Jan 30 '22 15:01 WebMechanic

@WebMechanic

The reason why this feature has not been realized is due to the basic design of VSCode's contribution points as mentioned above.

There are many problems and challenges in dynamically rewriting files in an extended package. For example, macros have to take into account not only global settings, but also workspace and folder specific settings. In addition, VSCode Macros is designed not to load extensions until just before macro execution to save memory.

I don't have time to develop additional features for a while, so if you could make a contribution (pull request) regarding this, I will consider introduce it.

Regards.

exceedsystem avatar Feb 01 '22 11:02 exceedsystem