Vscode-remote-release: Explorer and source control extension not updating git status in WSL 2

Created on 7 Feb 2020  路  16Comments  路  Source: microsoft/vscode-remote-release

Hello,

For one of my projects, I develop by opening the folder in WSL (Ubuntu) using the remote WSL extension. I recently installed WSL 2 on my system and everything with a small exception works out of the box.

When I change a file in the folder, which is also a git repo, the explorer doesn't update to reflect the change in the repository. If I close the remote connection and reopen it again, it then shows the change. This doesn't effect the editor markup where you can see line changes, deletions, etc., but the git status changes are also not reflected in the VS Code Source Control tab.

I thought this may have to do with the git extension installed, but I uninstalled it and ran into the same issue, leading me to believe this is a VS Code bug.

  • VSCode Version: 1.42.0 (I also had this issue on 1.41)
  • Local OS Version: Windows 10 Enterprise Version 2004 Build 19041.21
  • Remote OS Version: Ubuntu 18.04 / Debian
  • Remote Extension/Connection Type: WSL

Steps to Reproduce:

  1. Change code in git repository
  2. Check VS Code explorer and Source Control for markup showing changes in git status

Does this issue occur when you try this locally?: No
Does this issue occur when you try this locally and all extensions are disabled?: No

Is anyone else experiencing this issue in WSL 2?

wsl2

Most helpful comment

Yep same problem. I need to refresh the explorer each time I make a change.
P.S: Folder is in the home directory.

All 16 comments

Hi, is there any update on this issue? I'm still experiencing this issue on the latest version of VSCode (1.44.1).

Can you

  • invoke the command Developer: Set Log Level and set Trace
  • reload the remote WSL window, open a folder
  • Open the Output view, go to the Log (Remote Server) tab
  • Look for messages from the File Watcher while you make file changes

I assuming you mean the Developer: Set Log Level command, correct? There's also a Git: Set Log Level command.

If you mean the developer one, the highest log level i can set is Trace. If I set it to trace, I don't see any logs from File Watcher as I make changes to files.

Yes, Developer: Set Log Level, Trace

Any other messages about the file watcher? There should be at least one when it's starting.
Also I'm curious if it has any error messages, such as running out of handles.

This seems to be the only message I'm getting from File Watcher:

[File Watcher (chokidar)] Start watching with chockidar: /mnt/d/dev/[redacted], excludes: /.git/objects/,/.git/subtree-cache/,/.hg/store/,/node_modules//,/home/tyler/.vscode-server/extensions/,/.asar, usePolling: false

I don't get any error messages at all and nothing related to handles as far as I can see.

The Remote Server Log indicates the file watcher is working and has detected all changes (I'm in the middle of a rebase). But the Source Control tab on the explorer doesn't seem to render the changes.

Also on WSL2

@trenslow Hm, the setup message looks all fine. The git excludes are fine.
You initially said that the file explorer does not update when files are created in the opened folders.
Or is it only the Git viewer (Source Control viewer)?

Can you open VSCode on a folder with only a few files in it and see if there's the same problem?

If it's a folder with a lot of files in it, you can try this:

It's both the Source Control viewer and the VS Code Explorer viewer as well. And it's not just when new files are created in the open folder, it's also when a git-tracked file is modified, deleted, etc. (when one would expect an M, D, etc. to show up next to the file name).

I opened a folder with only a few files (not sure what a few files means exactly, but this one has around 10 small yaml files) and it had the same behavior.

I also increased the max user watches and restarted VSCode and got the same result as before.

Thanks so much for your help so far. I wish I could provide more information, but up to now I haven't noticed anything else that would be of interest. I even tried restarting wsl process with no result.

I'm afraid I also don't know what's going on. Anything special about the location of the folder?
mnt/d means the d: drive of your machine? Is it a network drive?
Instead of a folder in mnt/d/dev, can you try with a folder in /home/tyler ?

The D: drive is a physical drive on my machine. I just tried in /home/tyler and now it works as it should. Also for completeness, I tried with a folder on my C: drive and it works as well. Somehow the watcher doesn't like the D: drive.

edit: I also noticed that the small clock symbol on the Source Control viewer icon doesn't appear when the folder is opened from the D: drive, but it does when opened in my Linux home folder as well as the C: drive. Not sure if that helps.

edit 2: After more playing around, I realized that if you open the folder from the Linux terminal using the command 'code .', the git tracking works, regardless of which drive/file system the folder resides on. It's only when using the remote button in the bottom left corner of VSCode, or the command palette to open a folder in WSL, where the Source Control viewer and File Explorer fail.

WSL2 still has multiple open issues about missing file events on the mounted drives, e.g. https://github.com/microsoft/WSL/issues/4169, https://github.com/microsoft/WSL/issues/4739
I don't know the latest progress on these issues.
Note that the recommendation is to put your files in the Linux filesystem. It also gives you the best file system performance. You can still access the files from the Windows side through the \wsl$\ network drive.

Edit 2 is interesting. Can you have a look what the log says about the file watcher, when things work? Like in https://github.com/microsoft/vscode-remote-release/issues/2310#issuecomment-614134038

Ah ok the open issues would probably explain it then. I figured moving the files to the Linux file system would totally fix my problem, but it would require a lot of moving things around, so I was trying to avoid it if possible.

Regarding edit 2: I don't seem to be getting any logs from File Watcher:
image

My source control tab never updates when I commit changes. It just shows a file with zero changes, and won't go away until I 'discard all changes' (which doesn't actually discard them because they are already committed)

I have the repository on /home in WSL2, so I'm not sure why it's not updating.

image

I have the same problem as @MarcelloTheArcane with the repo on the home folder I can't see git changes in the Source Control Viewer

Yep same problem. I need to refresh the explorer each time I make a change.
P.S: Folder is in the home directory.

It started working for me when I closed the wsl connection and started it again. Don't know what was the exact issue.

Was this page helpful?
0 / 5 - 0 ratings