Code-server: Editors backed by files in browser storage don't update when externally modified

Created on 17 Oct 2020  Â·  8Comments  Â·  Source: cdr/code-server

  • Web Browser: Chrome v86.0.4240.75
  • Local OS: Windows
  • Remote OS: linux
  • Remote Architecture: x86_64
  • code-server --version: 3.6.1 65d3f51562ab1c0ff4ff69dc930a46136d92b158

It seems like the new Update breaks syncing of local user settings to code-server.
Changes to the settings.json (Ctrl + ,) are not synced to or from the server.

bug

Most helpful comment

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

All 8 comments

Thanks for testing out 3.6.1! By sync do you mean they aren't saved? I
tested it out a bit but it seems to be saving. Or is this about
https://github.com/cdr/code-server/issues/2195?

Everything saves correctly (i assume), but any changes are only saved in one place. And i dont think its related to #2195 (although this would be awesome). Im sorry if i do a bad job explaining this, so heres a picture:

image

In version 3.6.0 any changes to settings in the User tab are automatically applied in the Remote tab as well. This also worked the other way around so opening the page in an incognito window (or another machine) got you all settings from the Remote tab in the User tab.

In 3.6.1 however these tabs are not synced, so any changes to the User tab do not show up in the Remote tab. Also any settings stored in Remote are not synced to User and therefore not applied. If i change anything in the User tab manually it applies all settings fine and direct changes to the remote settings.json are reflected on disk (serverside). I can open both settings.json files at the same time and copy&paste between them, but thats not as easy with keybinds / shortcuts.

One last note: I did install 3.6.1 via the package downloaded from the Releases page, extracted it to /usr/lib/code-server and softlinked /usr/lib/code-server/bin/code-server to /usr/bin/code-server. All in a fresh archlinux/base container. For 3.6.0 i did use the install.sh script which pulled code-server from the AUR. Maybe it does something else i did not catch and this issue is just the server having some sort of permission problem. That said, i did also test the .deb package in a debian container and it had the same issue.

Ahhh I see. I think the syncing might actually have been a bug in 3.6.0
in that case. Is there a reason they should be synced?

I think "user" is for that instance of code-server and "remote" is for
any remote instances code-server connects to. I don't think it's
actually possible to connect code-server to a remote at the moment so
really we probably shouldn't show that tab at all.

The terminology is a bit confusing though since code-server is usually
accessed remotely, but it's different than the "remote" referred to
here which is about the SSH, Docker, and WSL remote extensions.

Oh okay i see, when it comes to standalone VSCode the terminology is quite clear, but if you separate it into a frontend and a backend this gets quite confusing 😄

I did some testing with the old versions and it seems that versions 3.4.1 and below separated the User and Remote configs while in 3.5.0 and up they have become one file. I did test with a normal chrome window and an incognito window.

In 3.4.1 the User config is stored in $user-data-dir/User/settings.json and the Remote config in $user-data-dir/Machine/settings.json. Both windows show the same files, with the left file being the Remote config and the right the User config. If i change any setting in one window it is automatically synced to the other one although never appearing in the Remote file.

image

In 3.5.0 the file paths shown in the browser change:

image

Also the "Machine" folder inside the user-data-dir is gone. But any changes in one window still show up in the other. The path for the User config on disk stays the same ($user-data-dir/User/settings.json)

In 3.6.1 the paths still show the same, but any changes i make to the User config do not show up in the other window:

image

Heres another screenshot with the same file open in both windows:

image

Do you have any idea if this is a misconfig on my side (eG some config im missing before starting code-server) or a bug?
Also let me know if i should test more things or provide more info.

Oh okay i see, when it comes to standalone VSCode the terminology is quite clear, but if you separate it into a frontend and a backend this gets quite confusing

Yes exactly! Well put.

So it looks like with 3.6.1 the user config is now stored in the browser and it looks like there's a bug where the editor doesn't update if a browser storage-backed file is updated externally. So modifying user settings in one tab won't update in another tab. That other tab will have to be refreshed to get the updated settings.

Definitely a bug. For now I think the only workaround is if user settings are modified in one tab to refresh the other tabs.

After updating to 3.6.1, now my settings are persisted in the browser but are not saved on server, basically nothing get saved anymore in ~/.local/share/code-server/User/, just for testing, I wiped ~/.local/share/code-server/User and now I see only these (global storage is empty):

➜ ls -al ~/.local/share/code-server/User/             
total 8
drwxr-xr-x   4 daddye  staff   128B Oct 23 16:34 .
drwxr-xr-x  10 daddye  staff   320B Oct 23 16:34 ..
drwxr-xr-x   2 daddye  staff    64B Oct 23 16:15 globalStorage
-rw-r--r--   1 daddye  staff   954B Oct 23 16:37 syncLocalSettings.json

I just tested the release of 3.6.1 and the issue persists. Going back to my two browser windows from above, no matter how i refresh the incognito window (normal, hard, clear cache, clearing application data and refresh) it never takes on the settings i place in the non-incognito window.

It also seems like other people have the same issue after upgrading to 3.6.1:

2231

2232

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

avelino picture avelino  Â·  3Comments

lshamis picture lshamis  Â·  3Comments

infogulch picture infogulch  Â·  3Comments

pchecinski picture pchecinski  Â·  3Comments

tecosaur picture tecosaur  Â·  3Comments