coder / code-server

VS Code in the browser
https://coder.com
MIT License
67.5k stars 5.53k forks source link

Theme resets to default on relaunch #2231

Closed wombatinua closed 3 years ago

wombatinua commented 3 years ago

After the latest update my selected theme resets to default Light+ after one or several consecutive client restarts. It doesn't matter what theme is selected before. If I open settings.json on server I see the theme is correct, but in workbench it resets to default. When the theme resets and I open Preferences -> Color Theme then it also resets in settings.json to "workbench.colorTheme": "Default Light+". Very weird.

I attach small video for the sake of demonstration https://cloud.dmitriypavlov.com/s/9YoT5scWALkcyq9 (theme resets on 3 relaunch). Please advice.

hurleyef commented 3 years ago

Same issue here too.

wombatinua commented 3 years ago

The workaround is to change the default theme to used one in Settings.

ZeeMoros commented 3 years ago

Probably related to this: I can't change appearance ex: I usually hide the Run button. Toggle Word Wrap doesn't work ether (doesn't activate at all).

wombatinua commented 3 years ago

Probably related to this: I can't change appearance ex: I usually hide the Run button. Toggle Word Wrap doesn't work ether (doesn't activate at all).

Have no issues like that: can turn off panels and wrapping works.

benz0li commented 3 years ago

@code-asher With code-server 3.6.1, settings in ~/.local/share/code-server/User/settings.json are set as Remote only whereas with code-server 3.6.0 they are set both as User and Remote:


3 6 1-settings


3 6 0-settings

Update (2020-11-03): Problem also exists with code server 3.6.2

vnijs commented 3 years ago

I noticed this as well. First, it seems like the settings.json file in code-server/User is being ignored. If I copy the file from code-server/User to code-server/, however, and use Preferences: Open Setting (JSON) it still shows me a different file but with the same path. Very odd.

Not the paths shown for the two settings.json files in the screenshots below. Same path, different content.

image image

code-asher commented 3 years ago

Yeah I poked into it a little and it looks like the settings file on disk is now used for remote only (which won't be used at all for code-server since it can't run the remote extensions anyway) and the user settings are now stored in browser storage.

But even though it's actually in browser storage it still shows a file path in the editor and there seem to be other bugs with it too.

I haven't done any research yet to see if this is a known issue with VS Code web or if it's something caused by code-server, so I'll be checking on that as soon as possible.

vnijs commented 3 years ago

Thanks for checking on this @code-asher. Do you know if there is a way to update/change these user settings from the command line? I would usually just copy a settings.json file to the desired location. Not sure how that would work with a "file" in browser storage however.

wombatinua commented 3 years ago

Thanks for checking on this @code-asher. Do you know if there is a way to update/change these user settings from the command line? I would usually just copy a settings.json file to the desired location. Not sure how that would work with a "file" in browser storage however.

Hey I did my own research and found out that if I simply copy settings.json from /User (remote) to /code-server (local) it would have no effect at all as local settings seems to be virtual path and actually stored in browser Local Storage.

What I did is simply opened User preferences within code-server itself (cmd + shift + P, "settings") and pasted it's contents to local settings.json within code-server. Obviously when browser Local Storage resets this settings are lost.

Thanks all the devs for the commitment.

code-asher commented 3 years ago

Yeah I don't think there's an easy way to do this; copying manually like that seems like the only option.

The whole situation seems a bit weird to me so assuming VS Code doesn't make some kind of improvement I think maybe we should patch it to use the file system again.

bobbywaz commented 3 years ago

I have to change my theme back every 20 minutes. Someone please find a fix for this one!

vnijs commented 3 years ago

@code-asher I assume there is no way to use the settings-sync feature from VS Code correct (link below)? Is that feature perhaps why they are using browser storage now? Reverting/patching so the file system can be used for code-server would be great.

https://code.visualstudio.com/docs/editor/settings-sync

code-asher commented 3 years ago

Yeah I'm not sure we'd be able to get sync working as-is; we might need to host our own backend since I imagine Microsoft's is licensed similarly to the marketplace and there might be other hurdles.

The switch to browser storage could be related to sync but they had sync before the switch so I'm not sure.

Right now my plan is to update to 1.51 and see if the situation has changed and if not I'll dig in to resolve this.

code-asher commented 3 years ago

Actually no; the switch happened at the same time as sync right? Definitely could be related.

hluker commented 3 years ago

I hate to be that guy, but is there any progress on this issue? It's really not feasible to remain on the old version now with the security vulnerability and this is a really annoying problem when you switch between directories.

vnijs commented 3 years ago

@hurleyef Do you know which prior version are affect by the security vulnerability. I thought it was only 3.7.1.

hluker commented 3 years ago

Whoops, that's my bad -- only 3.7 and 3.7.1 are affected.

wombatinua commented 3 years ago

I hate to be that guy, but is there any progress on this issue? It's really not feasible to remain on the old version now with the security vulnerability and this is a really annoying problem when you switch between directories.

The workaround was already posted here. Just copy the settings file contents.

vnijs commented 3 years ago

@dmitriypavlov Not sure how useful that workaround really if "Obviously when browser Local Storage resets this settings are lost"

JtMotoX commented 3 years ago

The workaround was already posted here. Just copy the settings file contents.

@dmitriypavlov I think you are assuming that everyone uses only 1 computer. One of the key benefits of code-server is being able to remotely edit from any computer. Each computer/browser has its own local storage. Are you implying that I manually copy these settings to each computer I am going to use? If I make changes to the settings on my main personal system, those changes are not applied to my laptop or my work system, etc..

code-asher commented 3 years ago

I was hoping 1.51 had improved the situation but it looks like it's still using local storage. Now that 1.51 is merged this is my next priority.

nhooyr commented 3 years ago

Will be in v3.7.3 which I'll get out today!

mirekphd commented 1 year ago

"Who configures the configuration files"?

Hard-coding config files locations is very limiting when an app needs to be containerized and deployed into air-gapped environments...

We should aim the level of flexibility that more mature could-native IDEs and other apps have attained (with env vars and server startup args): https://docs.jupyter.org/en/latest/use/jupyter-directories.html https://docs.ray.io/en/latest/ray-core/configure.html etc.

Related issue opened for code: https://github.com/microsoft/vscode-remote-release/issues/6925

benz0li commented 1 year ago

Hard-coding config files locations is very limiting when an app needs to be containerized and deployed into air-gapped environments...

@mirekphd The file location for user settings (at ~/.local/share/code-server/User/settings.json) is just fine. It is not a limiting factor for deployments in containerised environment.

We should aim the level of flexibility that more mature could-native IDEs and other apps have attained (with env vars and server startup args):
https://docs.jupyter.org/en/latest/use/jupyter-directories.html
https://docs.ray.io/en/latest/ray-core/configure.html etc.

I am running code-server from within a customised JupyterLab container. User generated data is persisted because the home directory is mounted from a docker volume.


See https://demo.jupyter.b-data.ch for a reference deployment using JupyterHub and JupyterLab + code-server.


P.S.: