Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Explorer and source control extension not updating git status in WSL 2 #2310

Closed
trenslow opened this issue Feb 7, 2020 · 19 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) wsl2 WSL 2 related issues
Milestone

Comments

@trenslow
Copy link

trenslow commented Feb 7, 2020

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?

@egamma egamma added the wsl2 WSL 2 related issues label Feb 11, 2020
@trenslow
Copy link
Author

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

@aeschli
Copy link
Contributor

aeschli commented Apr 15, 2020

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

@trenslow
Copy link
Author

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.

@aeschli
Copy link
Contributor

aeschli commented Apr 15, 2020

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.

@trenslow
Copy link
Author

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.

@Shahaed
Copy link

Shahaed commented Apr 15, 2020

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

@aeschli
Copy link
Contributor

aeschli commented Apr 16, 2020

@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:

@trenslow
Copy link
Author

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.

@aeschli
Copy link
Contributor

aeschli commented Apr 16, 2020

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 ?

@trenslow
Copy link
Author

trenslow commented Apr 16, 2020

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.

@aeschli
Copy link
Contributor

aeschli commented Apr 17, 2020

WSL2 still has multiple open issues about missing file events on the mounted drives, e.g. microsoft/WSL#4169, microsoft/WSL#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 #2310 (comment)

@trenslow
Copy link
Author

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

@MarcelloTheArcane
Copy link

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

@alexxonline
Copy link

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

@issammani
Copy link

issammani commented Oct 28, 2020

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

@ZaidRehman
Copy link

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

@Muntasir2001
Copy link

Muntasir2001 commented Feb 9, 2021

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.

Edit 2 helped me....
I can confirm this

Edit: Initially, I tried "code {foldername}" which does not solve the issue....
You will need to go inside that folder that you are trying to open then do "code ." as @trenslow mentioned ...

@Muntasir2001
Copy link

The git tracking does not function properly though (when new file is created from file explorer and not from terminal, the git fails to identify it as new file and so i have to refresh the git controller in vs code)

@aeschli aeschli added this to the February 2021 milestone Feb 12, 2021
@aeschli aeschli added the bug Issue identified by VS Code Team member as probable bug label Feb 12, 2021
@aeschli
Copy link
Contributor

aeschli commented Feb 12, 2021

duplicate of #3959, fixed by #4455

We now use polling when watching the Windows file system mounts.
You can test that in the latest (1.54) insiders builds (Remote - WSL extension >= 0.54.0, requires 1.54)

@aeschli aeschli closed this as completed Feb 12, 2021
@rzhao271 rzhao271 added the verified Verification succeeded label Feb 25, 2021
@rzhao271 rzhao271 added *duplicate Issue identified as a duplicate of another issue(s) and removed verified Verification succeeded labels Feb 25, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Mar 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) wsl2 WSL 2 related issues
Projects
None yet
Development

No branches or pull requests

10 participants