Skip to content
New issue

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

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

Already on GitHub? # to your account

Editors backed by files in browser storage don't update when externally modified #2208

Closed
TheLD6978 opened this issue Oct 17, 2020 · 8 comments
Labels
bug Something isn't working
Milestone

Comments

@TheLD6978
Copy link

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

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.

@code-asher
Copy link
Member

code-asher commented Oct 20, 2020 via email

@TheLD6978
Copy link
Author

TheLD6978 commented Oct 21, 2020

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.

@code-asher
Copy link
Member

code-asher commented Oct 21, 2020 via email

@TheLD6978
Copy link
Author

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.

@code-asher
Copy link
Member

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.

@code-asher code-asher added the bug Something isn't working label Oct 22, 2020
@code-asher code-asher changed the title User data not syncronizing with code-server Editors backed by files in browser storage don't update when externally modified Oct 22, 2020
@DAddYE
Copy link

DAddYE commented Oct 23, 2020

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

@TheLD6978
Copy link
Author

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

code-asher added a commit that referenced this issue Nov 20, 2020
It's possible that using browser storage makes more sense with settings
sync, so we might want to revisit this once/if we get settings sync
working. As it currently is though, browser storage just causes jank.

The path was also missing a `User` at the end so I added that. This
might affect the Vim extension which would have been writing to the
wrong path previously but I don't believe it should affect anything
else since they would have been writing to browser storage.

- Fixes #2208
- Fixes #2231
- Fixes #2279
- Fixes #2274
@code-asher code-asher added this to the 3.7.3 milestone Nov 20, 2020
@nhooyr
Copy link
Contributor

nhooyr commented Nov 23, 2020

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

@nhooyr nhooyr closed this as completed Nov 23, 2020
theereechee added a commit to theereechee/code-server that referenced this issue Jan 12, 2021
* plugin: Plugin modules now export a single top level identifier

Makes typing much easier. Addresse's Will's last comment.

* plugin.ts: Fix usage of routerPath in mount

* plugin: Test endpoints via supertest

Unfortunately we can't use node-mocks-http to test a express.Router
that has async routes. See eugef/node-mocks-http#225

router will just return undefined if the executing handler is async and
so the test will have no way to wait for it to complete. Thus, we have
to use supertest which starts an actual HTTP server in the background
and uses a HTTP client to send requests.

* plugin: Give test-plugin some html to test overlay

* plugin: Make init and applications callbacks optional

* Fix formatting

* Add Slack link to issue template (coder#2282)

* Bump version and update README

* Add maintainers

* Fix trailing line breaks

* Bump chart app version

* Update CODEOWNERS file

* Deduplicate child process message dance

* Document getFirstPath better

* Re-add TLS socket proxy

* Close sockets correctly

* Avoid setting ?to=/

That's the default so it's extra visual noise.

* Refactor vscode init to use async

Hopefully is a bit easier to read.

* Clarify some points around the cookie domain

Also add a check that the domain has a dot. This covers the localhost
case as well, so remove that.

* Fix cleanup after getting message from vscode

* Remove <type> from onMessage

Turns out that while Typescript can't infer the callback return type
from it, Typescript can do the opposite and infer it from the callback
return type.

* Use baseUrl when redirecting from domain proxy

This will make the route more robust since it'll work under more than
just the root.

* Unbind message handler itself after getting message

Also switch `once` to `on` since we `off` them later anyway so no point
in making Node do it twice.

* Add separate handler for error

Feels like it parallels better with the other handlers.

* Update cert flag test

* Remove unused ts-expect-error from VS Code

I'm not sure why other builds are passing with this still in.

* helm: Move chart into ci/helm-chart

* helm: Fix README examples

Not sure where --name came from? Maybe an older version of helm.

Ah, it's from v2.16.7

* helm: Add link in install.md

* ci: Remove helm validation action in favour of helm kubeval directly

* node/routes: Fix error handling

We should always send HTML if the user agent expects it.

If they do not, they should clearly indicate such via the Accept header.

Closes coder#2297

* ci: Disable no-unused-vars for function args

See previous commit for failure introduced.

* ci: Only use helm kubeval if installed

* helm: Use upgrade --install everywhere

See @sreya's review

* v3.7.0

* ci: Update standalone build test

ms-toolsai.jupyter is now a dependency of ms-python and is installed
along with it.

* doc/ipad.md: Fix TOC

* ci: Improve release template (coder#2311)

* ci: Pin nfpm to v1.9.0

Closes coder#2310

* v3.7.1

* Fix log message (coder#2331)

* Skip heartbeat on /healthz endpoint (coder#2333)

I managed to lose this in the rewrite.

Fixes coder#2327.

* Split child and parent wrappers

I think having them combined and relying on if statements was getting
confusing especially if we want to add additional messages with
different payloads (which will soon be the case).

* Move onMessage so it can be used in the wrappers

* Parse arguments once

Fixes coder#2316.

* Remove unused wrapper options

Also move our memory default to the beginning of NODE_OPTIONS so it can
be overidden. The version of the flag with dashes seems to be the more
correct one now so use that instead of underscores.

Related: coder#2113.

* Fix webview 404s

An extra slash caused a 404 (was /webview//vscode-resource).

* Fix tar authentication

It was checking the request path but for tars the path is in the query
variable so the request path is irrelevant.

* login.css: Fix button styling on iOS

* Revert "login.css: Fix button styling on iOS"

This reverts commit f79bb21.

* login.css: Disable webkit appearance for input elements

Not sure why Safari does these things...

Closes coder#2247

* Fix service worker not loading (coder#2335)

I removed this under the impression the default was to allow it anywhere
but that's not the case. Since the service worker was already registered
in my browser I never got the error during testing.

* Update VS Code to 1.51.1

* Add new logger service

The telemetry service depends on this now. I had to move it into
invokeFunction and use accessor.get otherwise getLogger on the service
was undefined.

I also had to move some the extension management service because it
depends on the moved telemetry service. I moved a few other services as
well to better match VS Code (sharedProcessMain.ts).

I swapped some this.services.get with accessor.get since that seems to
be the correct method although for these other services either method
seems to work.

* Add new (unimplemented) terminal service

* Implement most of remote terminal service

It works, at least, but there are still some missing parts.

* Implement terminal replay event

* Handle non-persistent terminals

* Only replay terminals when detached

* Send back workspace ID and name in terminal list

This makes it re-connect automatically.

* Add timeout for disposing detached terminals

* Add notes on unimplemented terminal events

* Implement remaining resolver methods

* Use resolverEnv to get exec path

This is the last unused variable in the create terminal payload.

* Don't persist terminals for now

* v3.7.2

* ci: Fix typo in release template

* Use file system for settings and fix data home path

It's possible that using browser storage makes more sense with settings
sync, so we might want to revisit this once/if we get settings sync
working. As it currently is though, browser storage just causes jank.

The path was also missing a `User` at the end so I added that. This
might affect the Vim extension which would have been writing to the
wrong path previously but I don't believe it should affect anything
else since they would have been writing to browser storage.

- Fixes coder#2208
- Fixes coder#2231
- Fixes coder#2279
- Fixes coder#2274

* Remove semver-umd link

This is included in the bundle now.

* vscode: Update product.json

The new fields are from vscodium and make the welcome page
documentation links work correctly.

I also renamed the distribution to "code-server" so that when you're
in a browser, it now says code-server instead of Code OSS.

* vscode: Disable go home button

See coder#2328

* vscode: Customize welcome page for code-server

- Title/subtitle are now code-server and VS Code version
- Added a list of code-server help links

* vscode: Show notification when upgrade is available

And link to the release notes.

* doc: Add note on upgrading into release notes and install.md

Closes coder#1652
Closes coder#2221

* update.ts: Simplify comparison

* vscode: Add missing semicolons

See coder#2359

* vscode: Check updates with absolute path

In case the window location path changes. Not entirely sure if it can
but best to be on the safe side.

* v3.7.3

* Fix exthost error and warn logging (coder#2366)

Previously anything that wasn't "log" such as "warn" would end up doing
`logger[logger.warn]`. Would have caught this if I hadn't used `any`...

Fixes coder#2364.

* ci: Enable vscode linting

Updates coder#2359

* vscode: Make eslint pass

I disabled code-layering and code-import-patterns as I don't think we
can make them easily pass as we reference all sorts of code from both
browser and node files. At least not worth the headache now to refactor
everything.

* ci: Fetch vscode node_modules in lint.sh for eslint

* show popup on third attempt

* turn off visibleProgress on ConnectionLost

* one working solution without event suppression

* solution with forceDialog for attempt 3 and no change to VisibleProgress class

* revert reconnect wait times

* separate event domain from UI

* vscode: Remove background reconnection fixes from patch

I'll have to manually apply as they are not compatible with the latest
VS Code after rebase anymore.

* vscode: Reconnect in the background up to 5 seconds

Based on the previous commits by @mgmachado but simplified.

I also changed the threshold to error after a single attempt as the
connection has likely been borked and the user should be in the know if
they couldn't reconnect after 5 seconds.

Closes coder#1791

* vscode: Use options.base for update checking

See coder#2358 (comment)

* cli: Add --disable-update-check flag

Closes coder#2361

* vscode: Fix update check timeouts

Forgot an extra 60 in the check interval and the notification timeout.
Very unfortunate. Check has been allowed every 168 minutes instead of
every week.

* vscode: Fixes for linting

* Only attach to orphaned terminals (coder#2382)

Fixes coder#2356.

* Revamp icons (coder#2383)

I took our website's SVG favicon and plopped it on a round
white rectangle in Affinity Designer. The I exported it as an SVG and
wrote a script that uses imagemagick to convert to the various sizes and
formats we need.

Closes coder#2307

* browser: Fix HTML formatting

* v3.7.4

* Add "disabled by --link" note to certificate arg

* Remove logs mentioning --link being beta

* npm.md: Remove the "install Xcode" bit

coder#2398

* doc/npm.md: Fix formatting

* node: coder-cloud -> coder_cloud

File names should not have dashes.

* update.ts: Fix response memory leak

* Use proxy-agent to support $HTTP_PROXY

Closes coder#124

This works by monkey patching the http and https modules's default agent
at runtime to the one given by the proxy-agent package.

* proxy_agent.ts: Document that no other code passes in explicit agent

From my inspection as of this date anyway.

* media: Improve icon size (coder#2401)

See coder#2383 (comment)

* Add path to coder-logs in 'How do I debug...' section (coder#2389)

'How do I debug issues with code-server?` section of FAQ listed the logs for VS Code for coder#2. This commit includes the log location for code-server.

* vscode: Document argument to extensionHostProcess

* vscode/coder.js: Remove unnecessary vs/css and vs/nls args

buildfile.entrypoint ignores all args now and is hard coded to use these
strings as exclude.

* vscode: Fix @coder/logger version

The previously used version seems to be buggy. I was seeing undefined
errors when using a logger.named logger at level info.

* vscode: Fix exthost logging

Closes coder#2364
See coder#2366

cc @code-asher

My previous commit didn't fix anything but still good to update @coder/logger.

* Fix CI

* proxy_agent.ts: Document why there is no $HTTPS_PROXY support

* Update guide.md (coder#2125)

* doc/ipad.md: Add Servediter iPad App

Builds upon the previous commit.

Thanks @AckerApple

* Modify link arg and its desc to not be beta

* Update cloud program section of README

* add initial codetour

* doc: Describe issue triaging

* Remove cmoog assignment for extension requests

* doc: Elaborate on issue triaging

* doc: Switch screenshot to use Chrome

Safari runs code-server horribly. We shouldn't even pretend that it sort
of works.

See the issues tagged browser-safari!

Considered Firefox first but there's too many issues with it as well.

* Remove @coder-asher and @nhooyr from CODEOWNERS

Not every PR needs our review. We get notified anyway as we're watching
the repository.

* docs: add yarn to contributing requirements

* Add hashedPassword config (coder#2409)

Resolve coder#2225.

* Add tour points

* cli: Show beta flags in help output

Looks like

```
   -r --reuse-window         Force to open a file or folder in an already opened window.
 -vvv --verbose              Enable verbose logging.
      --link                 (beta) Securely bind code-server via Coder Cloud with the passed name. You'll get a URL like
                             https://myname.coder-cloud.com at which you can easily access your code-server instance.
                             Authorization is done via GitHub.
```

Based on commits by @JammSpread in coder#2405

Closes coder#2396

* add link to docs

* make tour work on all branches

* add development tour with commands

* change to directory

* Change tour directories from `file` to `directory`

`file` doesn't seem to work without a specific git reference, but adding
a reference makes the explorer not follow the tour. Unfortunately
`directory` doesn't show the directory contents so I added the directory
name and "see the explorer" to the comment.

* Link CONTRIBUTING.md from the tour

For now it has to be a full link but in the future it would be nice to
open it relatively in the editor.

* Add VS Code reqs link to development tour

* FAQ.md: Add mention of hashedPassword (coder#2453)

Closes coder#2451

* routes: Redirect from /# when auth is disabled (coder#2456)

Sometimes I start with auth but then disable. Now I can just reload the
login page in my browser to be greeted with code-server.

* release-image: Ignore $DOCKER_USER on restart (coder#2458)

Closes coder#2267

* install.sh: use $ID_LIKE to detect distro (coder#2423)

* release-image: Remove unnecessary call to chsh (coder#2457)

Confused me in coder#2410, see coder#2455

debian:10 defaults to bash as $SHELL

* feat: add home as a cli option

* chore: generate new patch

* docs: update FAQ with new go home customization

* docs: fix typo in docs

* chore: fix lint issue in patch

* refactor: fix bug in --home test

* chore: format FAQ

* fix: remove unused import in workbench.ts

* chore: revert accidental yarnlock changes in patch

* chore: revert yarn.lock to match master

* Revert yarn.lock to master

* Update ipad.md

I've been coding from my iPad to Raspberry Pi going on several months. I feel a pro at it and far prefer it over a cloud service for it has far less lag being local hosted.

* Add --ignore-last-opened option (coder#2434)

This allows bypassing the last opened behavior for certain cases where that's not desirable.

Fixes coder#1951

* Move ignore-last-opened to ipc.d.ts

This is so it can be used in VS Code. Don't tell anyone but I forgot to
run `yarn ci`.

* Use patience algorithm for diffs

This should prevent us from generating different diffs and adding noise
to our PRs. Patience seems like a good one; it generated a diff that I
felt was easier to read in the case of the yarn.lock optionator section.

* feat: add vscode:clean script

* chore: remove submodule

* Squashed 'lib/vscode/' content from commit e5a624b

git-subtree-dir: lib/vscode
git-subtree-split: e5a624b

* feat: apply patch after setting up subtree

* feat: remove vscode scripts used with submodule

* refactor: move vscode.sh to postinstall

* refactor: remove submodule code from steps scripts

* docs: update workflow and remove yarn vscode

* refactor: update workflow in codetour

* docs: fix codetour and docs

* docs: update based on feedback

* fix: add grep -v lib/vscode to git ls-files

* chore: format lint file

* Update ipad.md

Really tried the squeeze the most out of my own experiences with the hopes of helping others.

* Update ipad.md

Added table of contents links

* fix: remove unnecessary grep line in fmt script

* docs: add section for updating vs code

* chore: fix linting error

* Symlink node_modules.asar to node_modules in lib/vscode

Closes coder#2197.

* Implement callback endpoints

VS Code uses these during the authentication flow.

* Point to our auth relay

* ci/README: Document command used to find stale version

* proxy_agent: Fix very embarrassing mistake

* proxy_agent: Improve documentation

* proxy_agent: Implement $HTTPS_PROXY

Just convention, see https://golang.org/pkg/net/http/#ProxyFromEnvironment

* proxy_agent: Use proxy-from-env for robustness

Now we support pretty much every variable under the sun along with
$NO_PROXY all correctly and with minimal code on our end.

* doc/FAQ: Document proxy environment variables

* build: Do not let agent install fail the build

We don't have an agent for FreeBSD right now.

* clean.sh: Do not reset lib/vscode

Now that we've moved to the submodule, there is no need to reset changes
in there :)

cc @jsjoeio

* vscode: Remove electron dependency but keep types

Electron doesn't support FreeBSD.

* ci: Minor fixes for FreeBSD support

* doc/npm.md: Document npm module dependencies for FreeBSD

* install.sh: Add echo_npm_postinstall

Updates coder#2349

* Clarify why we need node_modules.asar

* Use full path for ignoring node_modules.asar

Co-authored-by: Anmol Sethi <hi@nhooyr.io>

* cli: hashedPassword -> hashed-password (coder#2454)

Capital letters in the CLI are evil.

cc @code-asher

* Swap negative check for positive check

* docs: Update nginx certbot to use python3 coder#2439

* Simplify query concatenation in URL callback

Cases in URLs like ?&a=b or ?a=b& appear to be handled just fine.

* release-image: Use more minimal packages coder#2462

* doc/npm.md: Update docs for Alpine Linux (coder#2479)

* doc/ipad.md: Fix formatting

* v3.8.0

🎅🏼

* docs: add details to updating vscode section

* Bundle callback.html into final build

* Fix symlink_asar failing if link is broken

This can happen if you `yarn release` without keeping node modules.

* Add typings to release bundle (coder#2544)

* Fix typings rsync

* browser: Add favicon.afdesign

It requires git-lfs to pull down if you want to adjust the favicon and
also the affinity designer software available only on Windows and Mac.

Might be a good idea to switch to Figma at some point and commit a
.fig file.

* gen_icons.sh: Document pwa-icon vs favicon having different design

* favicon: Add dark mode support

Closes coder#2538

Works as expected on latest Firefox and Chromium.

Co-authored-by: Anmol Sethi <hi@nhooyr.io>
Co-authored-by: Ben Potter <me@bpmct.net>
Co-authored-by: Matthew Beckett <matt@beckett.cloud>
Co-authored-by: Asher <ash@coder.com>
Co-authored-by: piousdeer <31318219+piousdeer@users.noreply.github.com>
Co-authored-by: Jacky <29943110+jw-12138@users.noreply.github.com>
Co-authored-by: Machado, Meygha <meygha.bhat@nielsen.com>
Co-authored-by: JK <u.sslooky@gmail.com>
Co-authored-by: ed789d0 <26331505+ed789d0@users.noreply.github.com>
Co-authored-by: Colton Saska <colt.saska@gmail.com>
Co-authored-by: Acker Dawn Apple <AckerApple@users.noreply.github.com>
Co-authored-by: Joe Previte <jjprevite@gmail.com>
Co-authored-by: SPGoding <SPGoding@outlook.com>
Co-authored-by: Oxylibrium <akashthenerd@gmail.com>
Co-authored-by: JammSpread <61063879+JammSpread@users.noreply.github.com>
Co-authored-by: Mayank Soni <mayanksoni282@gmail.com>
Co-authored-by: Jean-Yves LENHOF <jean-yves@lenhof.eu.org>
Co-authored-by: Oxylibrium <akash@coder.com>
Co-authored-by: Sean Smith <scsmithr@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants