exceedsystem / vscode-macros

This extension gives the macro features to your vscode.
https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
MIT License
38 stars 2 forks source link

[feature] Show assigned Macro Name in command bar #7

Open WebMechanic opened 2 years ago

WebMechanic commented 2 years ago

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:

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

Thank you.

exceedsystem commented 2 years ago

@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.

WebMechanic commented 2 years ago

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 commented 2 years ago

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:

exceedsystem commented 2 years ago

@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.)

WebMechanic commented 2 years ago

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.

exceedsystem commented 2 years ago

@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.