code-server
code-server copied to clipboard
File explorer doesn't show new files created from command line
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
- launch code-server 4.0.0 pre-release
- open Integrated Terminal
- 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
Oh yeah I noticed this too, I have to keep refreshing the explorer.
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.
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.
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
- run code-server 4.0.0 with the
-vvv
flag - open workspace/folder
- create new file in the terminal:
touch yo.txt
- 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 🤔
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).
Thanks for reporting! We'll see if we can reproduce!
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.
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)
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 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
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 hmm...can you post steps to reproduce? Also, does this happen in Codespaces?
Steps to reproduce:
- open a file in the editor
- open a shell > cd to the file >
echo "test" >> file
- see changes in editor (no changes)
- switch tab and switch back ("test" added)
What do you mean with Codespaces?
Or should I create a separate bug report for that?
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
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.