pop-os / libcosmic

WIP library for COSMIC applications
https://pop-os.github.io/libcosmic/cosmic/
Mozilla Public License 2.0
456 stars 40 forks source link

COSMIC overrides entire VSCode settings on every login #538

Open hgaiser opened 3 months ago

hgaiser commented 3 months ago

Everytime I log in, COSMIC overrides my entire settings.json file for VSCode. All the settings are gone and replaced with only a COSMIC theme. The intend of cosmic-theme is to only inject the theming part, but this line does not work for VSCode settings.json files.

VSCode settings.json does not strictly follow the json syntax. It, for instance, also allows trailing comma's and comments. If this syntax is used, serde_json produces an error. Since my settings.json file includes trailing comma's, COSMIC throws away the entire file because it fails to parse it.

The issue with serde_json:

fn main() {
    let _settings: serde_json::Value = serde_json::from_str("// Some comment\n{\"foo\": \"bar\",}").unwrap();
}

Produces the error:

thread 'main' panicked at src/main.rs:2:101:
called `Result::unwrap()` on an `Err` value: Error("expected value", line: 1, column: 1)

Or simply:

fn main() {
    let _settings: serde_json::Value = serde_json::from_str("{\"foo\": \"bar\",}").unwrap();
}

Produces:

thread 'main' panicked at src/main.rs:2:84:
called `Result::unwrap()` on an `Err` value: Error("trailing comma", line: 1, column: 15)

I'm not sure if there is a crate that can parse this style of json correctly (see this issue).

Regardless, I'm not a fan of forcibly setting the theme for an application like VSCode. My suggestion would be to add a theme to the VSCode extension marketplace and direct users there, if they wish to use it.

Drakulix commented 3 months ago

If nothing else, we shouldn't override a file we can't parse.

Also in the meantime, cosmic is only doing this, if you enable the experimental "Apply this theme to GNOME apps" option.

hgaiser commented 3 months ago

If nothing else, we shouldn't override a file we can't parse.

Also in the meantime, cosmic is only doing this, if you enable the experimental "Apply this theme to GNOME apps" option.

Ah thanks, I can at least disable this behavior for now :)

hgaiser commented 3 months ago

By the way, this behavior still seems to happen when "Apply this theme to GNOME apps" was disabled.

Vedantpr0 commented 3 months ago

As @hgaiser said this behaviour is happening after disabling also. Btw never enabled it. Their is something else. Cc: @mmstick

Vedantpr0 commented 3 months ago

https://drive.google.com/file/d/1Jwo9eQoCFkHaXfojSA0urX5P9Kj1T3RO/view?usp=drivesdk