oleg-shilo / Favorites.vscode

VSCode extension for managing Favorites
MIT License
23 stars 6 forks source link

Suggestion: Rename a favorite file or folder (set alias) #35

Open carloscadux opened 2 years ago

carloscadux commented 2 years ago

Hi, Just a suggestion about the only functionality I missed in your outstanding extension. Thanks, Carlos

a) Rename in the list directly, through some type of convention like this: "CustomNameA - File1.txt" C:\File1.txt

b) Rename through context menu, followed by pop-up dialog.

Please see the images below illustrating (a) and (b)

image

image

oleg-shilo commented 2 years ago

That is a good suggestion Carlos. Though it's already implemented even though in a slightly different way.

In cases if an alternative display title (alias) for a file is desired you can use this simple syntax to achieve that: <file path>|<file aliase>

image.

It was a feature request #15, Unfortunatelly the the main page has failed to mention it. I updated it now.

carloscadux commented 2 years ago

Hey Oleg,

Thank you for the information. Your aliases syntax is straightforward and easy using.

Could you please confirm the only way to set an alias for favorite files/folders is by editing the list.txt directly?

If yes, have you considered adding 'rename' command in the context menu, followed by a pop-up dialog (same way your extension already does for renaming the top lists)?

The 'rename' command would speed up the process of setting aliases, mainly when your list.txt is already populated by dozens of favorite files/folders, and you need to search for the specific one you want to rename.

image

oleg-shilo commented 2 years ago

Done. "Rename" is problematic as it implies that the menu item needs to be e]nabled/disabled dynamically - very challenging in VSCode.

So I set it to: image

carloscadux commented 2 years ago

Done. "Rename" is problematic as it implies that the menu item needs to be e]nabled/disabled dynamically - very challenging in VSCode.

Thank you very much for your effort and the implementation of the functionality 👍

Just taking the opportunity of this conversation to ask you about VSCode API. Can the "context menu" be sensitive to different parts of your extension. For instance, if you click on the "lists" (top part) some commands would appear; if you click on the favorites (bottom part), another set of commands are listed. Is it feasible?

oleg-shilo commented 2 years ago

I do not think so. This is a huge drawback in VSCode API compared to normal UI applications. the runtime assets need to be set up at the build time (config file), not at runtime. You can only put conditions based on the VSCode entities but not on the extension state:

image

The above fragment of config dictates that the right-click menu item is to be displayed when "favorites" extension view is right clicked. You cannot make it based on the item being clicked :(