MikeBaz - MSFT
MikeBaz - MSFT

Reputation: 3258

How do I get Visual Studio Code in Windows against WSL to be case sensitive?

I am using Visual Studio Code 1.52.0 in Windows against a WSL filesystem. The filesystem is marked case-sensitive in WSL:

mikebaz@PSTower-2020-06:~/code/test$ getfattr -n system.wsl_case_sensitive .
# file: .
system.wsl_case_sensitive="1"

and correctly shows as case-sensitive in File Explorer (so there isn't a basic Windows issue here). There are two folders with the same name, but different cases:

two folders, "Folder1" and "folder1", in File Explorer

However, in Visual Studio Code, these folders are collapsed into one folder:

Visual Studio Code EXPLORER view showing "folder1"

This also impacts the source code status for the Git repo in the folder - Code seems confused. Although there is a file and it's properly tracked and committed:

mikebaz@PSTower-2020-06:~/code/test/Folder1$ git status -u
On branch master
nothing to commit, working tree clean

the Code view insists that there's an untracked file:

Git status in Code showing the green "U" for "Untracked" under "Changes"

How can I tell Visual Studio Code to stop trying to "help" me by collapsing the two folders and being confused as a result?

Upvotes: 1

Views: 878

Answers (1)

NotTheDr01ds
NotTheDr01ds

Reputation: 20765

I was able to reproduce your issue by:

  • Creating ~/temp/Folder1 and ~/temp/folder1
  • Launching VSCode
  • File -> Open Folder
  • Opening the folder \\WSL$\<distroname>\home\<username>\temp

And yes, I see the unwarranted (and unwanted) folder deduplication you are seeing.

However, do you have the Remote - WSL extension or the Remote Development extension pack installed? With Remote - WSL, I can open the folder through the remote connection and see both Folder1 and folder1.

In WSL:

  • cd ~/temp
  • code .

And everything is displaying correctly.

Note: This seems to be a known issue (although perhaps not quite in the way that you are encountering it).

As for the problems it seems to be causing with the git repo, you might want to try disabling the VSCode git integration as described in this thread.

Side note, one of my first tests was to try toggling the Compact Folders setting on (it is on by default, but I had disabled it), but that didn't have any impact on this particular issue.

Upvotes: 1

Related Questions