code-server icon indicating copy to clipboard operation
code-server copied to clipboard

File explorer doesn't show new files created from command line

Open jsjoeio opened this issue 3 years ago • 16 comments

OS/Web Information

  • Web Browser: Brave
  • Local OS: macOS
  • Remote OS: macOS
  • Remote Architecture: macOS (not M1)
  • code-server --version: 4.0.0 (pre-release)

Steps to Reproduce

  1. launch code-server 4.0.0 pre-release
  2. open Integrated Terminal
  3. create new file: touch hello.txt

Expected

The File Explorer should show the newly created file.

Actual

It doesn't show.

Logs

N/A

Screenshot

Notes

This issue can be reproduced in VS Code: No

jsjoeio avatar Dec 15 '21 20:12 jsjoeio

Oh yeah I noticed this too, I have to keep refreshing the explorer.

code-asher avatar Dec 15 '21 21:12 code-asher

Do you have any ideas on what might cause this? I'm not too sure where to look 🤔 But I'll look into this tomorrow.

jsjoeio avatar Dec 17 '21 00:12 jsjoeio

I feel like it must be in the file watcher somewhere, I think maybe the first thing would be to make sure it is picking up changes in the workspace.

code-asher avatar Dec 17 '21 16:12 code-asher

I think maybe the first thing would be to make sure it is picking up changes in the workspace.

Okay looking into this now.

Ensuring the file watcher picks this up

  1. run code-server 4.0.0 with the -vvv flag
  2. open workspace/folder
  3. create new file in the terminal: touch yo.txt
  4. look at server logs

Logs:

[13:55:28] [File Watcher (parcel)] [ADDED] /Users/jp/Dev/repros/cs-4630/yo.txt
[13:55:28] [File Watcher (parcel)]  >> normalized [ADDED] /Users/jp/dev/repros/cs-4630/yo.txt

This means the File Watcher is seeing this change. That's a good first step. Not sure why the File Explorer isn't rendering this in the view.

I'll update this comment with more notes.

Comparing with upstream

I see a flag called fileWatcherPolling upstream. Maybe that value is missing?

Nope.

Looking at the explorerService

This looks useful: https://github.com/microsoft/vscode/blob/main/src/vs/workbench/contrib/files/browser/explorerService.ts#L79-L80

For some reason it can't find the parent for the new resource 🤔

Digging deeper and looking at _foldersMap, we've learned that the folder is missing the authority but the resource has it. Not sure why 🤔

jsjoeio avatar Dec 17 '21 20:12 jsjoeio

This happens again for me. I freshly installed 4.0.1 on Debian 11 via the install script. Then I run it as

mkdir wd && code-server --bind-addr 0.0.0.0:8080 --auth none wd

Once connected with the editor, I open the integrated terminal and type

touch afile.txt

but nothing appears in the explorer. If I reload the page afile.txt appears in the explorer, and the following message (among many others) appears twice in the console log of the browser

WARN [File watcher]: started ignoring events due to too many file change events at once 
(incoming: 1, most recent change: vscode-log:/20220118T092634/window.log). 
Use 'files.watcherExclude' setting to exclude folders with lots of changing files 
(e.g. compilation output)

I've tried playing with files.watcherExclude adding whatever seemed reasonable, such as

"files.watcherExclude": {
  "**/.local": true,
  "**/.vscode-remote": true
}

but it doesn't seem to make any difference.

Any help will be appreciated, meanwhile I'll revert to 3.12.0 (that under the exact same circumstances doesn't show the bug).

mapio avatar Jan 18 '22 08:01 mapio

Thanks for reporting! We'll see if we can reproduce!

jsjoeio avatar Jan 18 '22 17:01 jsjoeio

I have the same problem with Explorer on 4.0.2 and in addition, changes to an open file are also not immediately displayed when I have made changes to it via the terminal. This complicates the work sometimes considerably.

The cause is probably the same.

reaseno avatar Feb 03 '22 18:02 reaseno

same problem on 4.0.2, here is the terminal log :)

[IPC Library: Pty Host] DEBUG ChildProcessMonitor: Has child processes changed true
[IPC Library: Pty Host] TRACE IPty#pid
[IPC Library: Pty Host] TRACE Flow control: Ack 5000 chars (unacknowledged: 283)
[10:59:26] [File Watcher (parcel)] [CHANGED] /Users/george/wd/ls
[10:59:26] [File Watcher (parcel)]  >> normalized [CHANGED] /Users/george/wd/ls
[IPC Library: Pty Host] DEBUG ChildProcessMonitor: Has child processes changed false
[IPC Library: Pty Host] TRACE IPty#pid
[IPC Library: Pty Host] TRACE Flow control: Ack 5000 chars (unacknowledged: 579)
[IPC Library: Pty Host] TRACE Flow control: Ack 5000 chars (unacknowledged: 698)
[IPC Library: Pty Host] TRACE Flow control: Ack 5000 chars (unacknowledged: 2475)
[IPC Library: Pty Host] TRACE IPty#pid
[IPC Library: Pty Host] TRACE Flow control: Ack 5000 chars (unacknowledged: 58)
[IPC Library: Pty Host] TRACE IPty#pid
[10:59:39] [File Watcher (parcel)] [CHANGED] /Users/george/wd/ls
[10:59:39] [File Watcher (parcel)]  >> normalized [CHANGED] /Users/george/wd/ls
[IPC Library: Pty Host] TRACE IPty#pid
[2022-02-18T02:59:49.714Z] debug 2 active connections
[2022-02-18T02:59:49.714Z] trace heartbeat
[10:59:54] [File Watcher (parcel)] [DELETED] /Users/george/wd/ls
[10:59:54] [File Watcher (parcel)] [DELETED] /Users/george/wd/sfsdaf
[10:59:54] [File Watcher (parcel)]  >> normalized [DELETED] /Users/george/wd/ls
[10:59:54] [File Watcher (parcel)]  >> normalized [DELETED] /Users/george/wd/sfsdaf
[IPC Library: Pty Host] TRACE Flow control: Ack 5000 chars (unacknowledged: 23)

mercury7720 avatar Feb 18 '22 03:02 mercury7720

Because of this error I can not update at the moment. Since three updates the priority of this bug is set to high. So may I ask what is the status of the fix?

reaseno avatar May 08 '22 18:05 reaseno

@reaseno does this still happen on the latest version? I can't reproduce it locally on macOS + Brave.

Video

https://user-images.githubusercontent.com/3806031/167499395-1e37efce-93d8-4773-a6ac-e297f034074a.mov

jsjoeio avatar May 09 '22 21:05 jsjoeio

The explorer of code 4.4.0 shows here under Windows + Vivaldi also new files or deletions immediately. However, it still does not work that if I make changes to a file in the shell (e.g. with sed), that these changes are also displayed in the editor. It is always necessary to switch back and forth between tabs for the data to be updated in the editor.

reaseno avatar May 10 '22 09:05 reaseno

@reaseno hmm...can you post steps to reproduce? Also, does this happen in Codespaces?

jsjoeio avatar May 10 '22 19:05 jsjoeio

Steps to reproduce:

  1. open a file in the editor
  2. open a shell > cd to the file > echo "test" >> file
  3. see changes in editor (no changes)
  4. switch tab and switch back ("test" added)

What do you mean with Codespaces?

reaseno avatar May 10 '22 22:05 reaseno

Or should I create a separate bug report for that?

reaseno avatar May 18 '22 16:05 reaseno

Thank you! Sadly, I couldn't reproduce the issue

Video

https://user-images.githubusercontent.com/3806031/169411854-488ee929-8118-4fba-8575-dfce344f91a2.mov

Ah, I meant can you reproduce this using Codespaces: https://github.com/features/codespaces

jsjoeio avatar May 19 '22 22:05 jsjoeio

Ok, strange. Reproduction seems to be more complicated than I thought. I notice that it doesn't always occur. But when it does, it always does. But then you can solve it by restarting the web app or reloading it in the browser.

I will see under which conditions the problem occurs and will report back.

reaseno avatar May 31 '22 14:05 reaseno