Diogo-Rossi / vscode-settings-switcher

Easily switch between custom setting configurations
https://marketplace.visualstudio.com/items?itemName=rossidiogo.vscode-settings-switcher
MIT License
5 stars 0 forks source link

Make changes to workspace config rather than user config? #1

Closed dufferzafar closed 10 months ago

dufferzafar commented 1 year ago

Is it possible to modify the settings in the Workspace settings.json file rather than using the User settings.json?

This would ensure that only current workspace is affected!

Diogo-Rossi commented 1 year ago

Hi @dufferzafar , thanks for your message!

I was thinking the extension already did that, because it came from the other extension vscode-settings-on-fire, but it seems it did not. I will look at it. Thanks for the message!

Diogo-Rossi commented 1 year ago

Hi @dufferzafar, I took a look on this.

Actually, the way this extension works makes it possible to define the groups of settings in the current Workspace settings, in the same way the extension vscode-settings-on-fire does.

i.e., you need to define the group "settingsSwitcher.lists" in the settings.json of the current Workspace.

Is that ok?

Diogo-Rossi commented 1 year ago

I added this remark in the README to clarify.

Diogo-Rossi commented 10 months ago

I've reopened this issue after @dmyger's comment in #2:

But that's only half of the problem. Your extension and "Settings Cycler" are too close in functionality, but both have the same issue. And yes, you offer some solution by saying that settings are only applied where they have been declared, while Cycler works always with global scope. But what killer feature was forgotten - "declare once, but use it in multiple places". At least extensions with such features are missing on Marketplace. Similar issue https://github.com/hoovercj/vscode-api-playground/issues/15 in the Settings Cycler and was rejected with a rather odd explanation. And overall that expansion looks long abandoned. I mean here that it would be wonderful to have a "scope" option in the group to specify where it should apply. At least with two choices [global, workspace].

Now there is a new optional key _scope that may be added to each group of settings.

This key accepts the values "global" (or "user") and "workspace" (or "local") .

Example:

"settingsSwitcher.lists": {
    "Vertical rulers": {
        "_scope": "workspace",
        "Ruler 80": {
            "description": "Cyan ruler line at column 80",
            "editor.rulers": [{"column": 79, "color": "#4f717a" }]
        },
        "Ruler 85": {
            "description": "Yellow ruler line at column 85",
            "editor.rulers": [ { "column": 84, "color": "#615f44" }]
        },
        "Ruler 95": {
            "description": "Blue ruler line at column 95",
            "editor.rulers": [ { "column": 94, "color": "#00028a" }]
        },
    },
}
Diogo-Rossi commented 10 months ago

I've add this observation to README.

Diogo-Rossi commented 10 months ago

This feature was added in v0.6.0