Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid settings not recognized in settings.json #199658

Closed
SharakPL opened this issue Nov 30, 2023 · 6 comments
Closed

Valid settings not recognized in settings.json #199658

SharakPL opened this issue Nov 30, 2023 · 6 comments
Assignees
Labels
config VS Code configuration, set up issues feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code

Comments

@SharakPL
Copy link
Contributor

SharakPL commented Nov 30, 2023

It would be nice to have a proper structure in settings.json. eg. to have this:
obraz
instead of this:
obraz

And it works both ways! The problem is these grouped settings are not recognized properly:

vscsettingsjson.mp4

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.84.2
  • OS Version: WIndows 11 23H2

Steps to Reproduce:

  1. Open settings.json
  2. Change any setting to a json object
@goyalyashpal
Copy link

goyalyashpal commented Nov 30, 2023

have a proper structure in settings.json
2. json object

i was thinking on same lines just 2-3 days ago, that toml allows both formats
it would make the state of settings to be very manually manageable (see here: #198081 (comment))

it would drastically simplify my configuration as well.

but the question is, does the .json format used allow this? i tried in the "debug console" off of from a dummy debug session with extension ms-vscode.js-debug the following:

> extCr = { "settings" : { "extensions.autoUpdate": false, "extensions.enableExperiments": false, } }
<- {settings: {…}}

> extProp = { "settings" : { "extensions": { "autoUpdate": false, "enableExperiments": false, } } }
<- {settings: {…}}

> extCr.settings.extensions
<- undefined

> extProp.settings.extensions
<- {autoUpdate: false, enableExperiments: false}

so, these two i.e. {"breadcrumbs.icons": "false", "breadcrumbs.showFields": false} is not same as {"breadcrumbs": {"icons": false, "showFields": false}} - javascript just doesn't work that way.

so, i suppose the solution can be in either of these forms:

  1. change the settings to accept proper json objects, rather than strings as keys.
  2. semantically move away from standard json - doing some logic on the backend where these are read; or
  3. providing option to use some other config format (which then, say, transpiles to the javascript or json or whatever is required here)

refences:

@goyalyashpal
Copy link

goyalyashpal commented Nov 30, 2023

  • after motivated by toots regarding "have u used profiles" all around here (most recently: this Support loading/storing view layout/locations in settings.json #198611 (comment)),
  • as apparently it is more capable than settings.json as it can contain the layout information, as well as enable/disable extensions, etc which the former can't
  • i thought about finally looking at the profiles feature and the generated profiles.code-profile file, and
  • oh my my. what a ... it was 🤦 . it had more backslashes than vanilla lisp has parenthesis; it had no directly parseable structure what-so-ever.

it was plain collection of strings - i suppose all it does is take those strings, and output them in their own separate files - which would consume the backslashes, and produces the normal .json files used elsewhere in vscode.

conclusion? - i didn't find anything fruitful in this regard in that file.

here's its structure:

{
    "name": "",
    "settings": "",
    "keybindings": "",
    "snippets": "",
    "extensions": "",
    "globalState": ""
}

2023-11-02

  • Continuing my investigation, F1 > "Show profiles(s|contents)" > UI State > globalState.json
  • i used extensions like andyyaldoo.vscode-json and chouzz.vscode-better-align

and it seems to be that vscode team is trying to avoid specifying nested objects, and rather escaping it & putting it as string.

but i can't understand why?

this makes it super hard to read. make the invesitgations multi-multi step & not toolable. and make tweaking & testing things up manually near impossible.

@LunarLanding
Copy link

I think this might be why #43670 (comment)
It seems support for managing settings.json is becoming lackluster, which is concerning; declarative configurations are easier to debug than UI widgets.
In order to manage my config, I found out I could not sort it in vscode because it had keys that started with *.
I sorted mine by using this python snippet.

def sort_settings_s(s):
    true=True
    false=False
    f=lambda d: {k:f(d[k]) for k in sorted(list(d.keys()))} if isinstance(d,dict) else d
    s2=f(eval(s))
    return json.dumps(s2,indent=' '*4)

@sandy081 sandy081 added feature-request Request for new features or functionality config VS Code configuration, set up issues *out-of-scope Posted issue is not in scope of VS Code labels Dec 4, 2023
@vscodenpa
Copy link

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Dec 4, 2023
@goyalyashpal
Copy link

I think this might be why #43670 (comment)

Now that we have the settings UI, we aren't investing much in the JSON editor

classic MS - our target audience is gooey using masses. though we love to name our tools as "power*" , but we dont like power users.

It seems support for managing settings.json is becoming lackluster, which is concerning; declarative configurations are easier to debug than UI widgets.

exactly what i was feeilng with the *.code-profiles becoming face of all things config related. and that file, like i said, is super "un"-toolable and is plain-text only on face of it

@goyalyashpal
Copy link

hey all! i have created a proposal which can help in grouping settings. though, not as properly as this, but still much better than no grouping. can u take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config VS Code configuration, set up issues feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

6 participants