AnWeber / vscode-statusbar-command

MIT License
16 stars 4 forks source link

Define commands in separate file #29

Closed lonix1 closed 1 year ago

lonix1 commented 1 year ago

I defined items in my .vscode/settings.json and it works well.

But is it possible to define the config in a separate file? e.g. .vscode/statusbar.json? That is convenient because it would be decoupled from the vscode config (which we have in source control).

AnWeber commented 1 year ago

I can implement such a Feature. My suggestion would be a settings with a path to this file. Or do you see the file per folder?

lonix1 commented 1 year ago

file per folder

Unsure what you mean - are you referring to a multi-root workspace?

My original thought was similar to the Code Spell Checker or Favorites Manager extensions (just as examples). In .vscode/settings.json, they allow you to define settings directly, or to define a path to a separate file (e.g. .vscode/my-dictionary.json).

But that is just one way to do it. Maybe you have a better idea?

AnWeber commented 1 year ago

There is a new setting which supports configuration of a external file.

image

I expect a array of commands in this file. Update to the file are immediatly updated in VSCode

lonix1 commented 1 year ago

1

Firstly, this is an awesome new feature, thanks so much for implementing it!

2

Secondly, it was very sad to learn that it's only available for "application settings" (~/.config/Code/User/settings.json).

In some workspaces where you collaborate with others it's indeed more useful like that, but in others it's more useful to define it in the "workspace settings" (.vscode/settings.json) directly.

I hope you'll reconsider to allow us to do either way - whichever is more suitable for a given project.

3

Thirdly, I couldn't get it to work. I did this:

I also tried "statusbar_command.commandsFile": "${workspaceFolder}/.vscode/statusbar.json".

vscode 1.80.2 extension 2.8.0

AnWeber commented 1 year ago

Thirdly, I couldn't get it to work.

The path must be absolute, because it is not workspace dependent. You should get an error listed in output of statusbar_commands works

Secondly, it was very sad to learn that it's only available for "application settings"

I may not understand the use case yet. It is always possible to have one .vscode/settings.json per workspace, which is then also committed. If you commit now only the special statusbarcommands.json it would not work without the extra entry in the workspace settings. For me the workspace settings are always more or less empty, what sense does it make to build such a construct here?