Skip to content

Issues with not case/fragment-normalizing file paths (macOS, Windows) #12448

Closed

Description

In VS Code we deal with resource URIs across all layers. In most cases we use URI.toString() to decide if a resource is equal to another resource. This assumption is not very good when we talk about file system paths because on macOS and Windows a file path should be considered equal if the paths are identical, even if the casing differs (/some/path === /SOME/path). Only Linux has a case-sensitive file system where this rule does not apply.

This leads to numerous related issues:

Activity

  1. changed the title [-]Issues when using wrong path casing when starting Code[/-] [+]Issues with mixed casing of file paths entering the workbench[/+] on Jan 3, 2017
  2. changed the title [-]Issues with mixed casing of file paths entering the workbench[/-] [+]Issues with not case-normalizing file paths (macOS, Windows)[/+] on Jan 3, 2017
  3. bpasero commented on Feb 6, 2017

    @bpasero
    ContributorAuthor

    Pushed a fix for the broken file events on macOS.

  4. changed the title [-]Issues with not case-normalizing file paths (macOS, Windows)[/-] [+]Issues with not case/fragment-normalizing file paths (macOS, Windows)[/+] on Feb 7, 2017
  5. BillDenton commented on Mar 2, 2017

    @BillDenton

    Any update on this? I keep tripping over it particularly when using the debugger.

  6. BillDenton commented on Mar 16, 2017

    @BillDenton

    Good to hear. I presume this will be available at the end of March. Is it available before that in the Insider Build?

  7. bpasero commented on Mar 16, 2017

    @bpasero
    ContributorAuthor

    BillDenton yes all in since today!

  8. 128 remaining items

  9. tommitytom commented on Apr 18, 2020

    @tommitytom

    To be fair, Visual Studio isn't (quite as) cross platform...

    https://visualstudio.microsoft.com/vs/mac/

  10. Gruntfuggly commented on Apr 18, 2020

    @Gruntfuggly

    That's why I said "quite". VSCode uses Electron and the node ecosystem which covers Windows, OSX and Linux.

  11. bpasero commented on Jun 5, 2020

    @bpasero
    ContributorAuthor

    Small update from our side: this milestone a few changes got pushed that should improve the situation specifically for files that use different casing on operating systems that have case-insensitive behaviour (Windows, macOS).

    For example, opening a file /some/path/file.css and /some/path/FILE.css would result in just 1 editor opening. Internally we introduced the notion of "canonical" URIs, meaning that the first time a file is opened, we take the casing for granted and anytime a different case is opened, we use the first one.

    We currently do NOT have plans to support other forms of file paths, such as:

    • symbolic links
    • Windows 8.3 filenames (e.g. textfi~1.txt)
    • Windows subst drive letters

    That means, in these cases you would still see 2 editors opening with different models each, even though it is the same file on disk. But the majority of issues seems to originate from casing differences.

    We are closing down for our May release with the changes included and monitor regressions which may require us to rethink the approach. But if everything goes well, this change should be available in stable early June.

    You can already benefit from this change if you switch to our insiders build (https://code.visualstudio.com/insiders) and we welcome feedback.

  12. added
    debtCode quality issues
    and removed
    under-discussionIssue is under discussion for relevance, priority, approach
    on Jun 12, 2020
  13. bpasero commented on Jun 12, 2020

    @bpasero
    ContributorAuthor

    This completed for June via #93368, closing. In our current 1.46.x stable release you should already see a single editor opening if the case of the file path differs on Windows and macOS.

  14. damyanp commented on Jun 12, 2020

    @damyanp
    Member

    Thank you! Great to see this addressed!

  15. benlesh commented on Jul 7, 2020

    @benlesh

    Benjamin Pasero (@bpasero) FYI: I'm in version 1.46.1 on Windows, I'm I'm seeing this issue.

    I created a file named wampBroker.ts, realized it should be renamed to WampBroker.ts, and renamed it through VS Code's file explorer on the left. The actual file was renamed to WampBroker.ts, it shows up in the explorer that way, but the tab is still showing wampBroker.ts. I tried shutting down Code and restarting, I even tried renaming it to blah.ts and then changing it to WampBroker.ts, but as long as it's named WampBroker.ts, it shows in the tab as wampBroker.ts. It's a minor annoyance at best, but the bug still seems to be there. Not sure what cache to clear to fix it.

  16. benlesh commented on Jul 7, 2020

    @benlesh

    Update: I figured out that (in Windows at least), if you wipe out the state.vscdb file under C:\Users\<user>\AppData\Roaming\Code\User\workspaceStorage\<find_the_right_directory> it resolves the issue the next time you open the workspace.

    The easiest way to find <find_the_right_directory> was to open the workspace in question and then close VSCode, then sort the workspaceStorage directory by Date modified.

    And I didn't "wipe them out", instead, I just renamed them to have the extension .old just in case anything was majorly broken.

    I'm not saying I recommend this hack, but it did work for me. 🤷‍♂️

  17. bpasero commented on Jul 7, 2020

    @bpasero
    ContributorAuthor

    The issue that renaming files to same path but different case is not reflected in the editor should be fixed with our upcoming 1.47 release. As usual, I highly recommend to install our insiders version that get's updated nightly and never worry about issues anymore because they get fixed asap.

    You can give our preview releases a try from: https://code.visualstudio.com/insiders/

  18. locked and limited conversation to collaborators on Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

debtCode quality issuesfile-ioFile I/O

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions