Skip to content

[api] Fix two filename case sensitivity issues - #64391

Merged
Andrew Branch (andrewbranch) merged 5 commits into
microsoft:mainfrom
andrewbranch:api/case-sensitivity
Sep 22, 2026
Merged

Andrew Branch (andrewbranch) merged 5 commits into
microsoft:mainfrom
andrewbranch:api/case-sensitivity

Conversation

@andrewbranch

Copy link
Copy Markdown
Member
  • Preserve original Windows drive letter case across API boundary 4da8232

  • On case-insensitive file systems, creating a snapshot VFS would infer directories case-sensitively on the client, while the server rejects duplicates case-insensitively, such that if you passed createFileSystem({ files: [["C:/Proj/main.ts"], [""], ["C:/proj/foo.ts"], [""]] }), this would be inferred as two distinct directories C:/Proj and C:/proj, but then be rejected by the server as duplicates.

    d02db3a fixed this on the server side by merging duplicates instead of erroring, but I didn't like how that blurred the difference between automatically inferred directories from case-inconsistent inputs and various real user-authored mistakes. I couldn't see a strong reason for the client to infer directories up front when the server already does, so the next commit removed the client-side inference in favor of just letting the server do it with its case-sensitivity knowledge.

Copilot AI balanced review requested due to automatic review settings September 22, 2026 16:41
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 22, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Sep 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The casing and directory-inference changes are consistent and covered across server and client APIs.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes Windows drive-letter casing across the API boundary and moves directory inference to the case-aware server.

Changes:

  • Preserves drive-letter casing when decoding file URIs.
  • Derives omitted directory listings server-side deterministically.
  • Updates sync, async, and Go regression tests.
File Description
tsc/​internal/​lsp/​lsproto/​lsp.go Preserves URI drive-letter case.
tsc/​internal/​ls/​lsconv/​converters_test.go Updates URI conversion expectations.
tsc/​internal/​api/​session_createprogram_test.go Tests snapshot drive-letter preservation.
tsc/​internal/​api/​requestfilesystem/​requestfilesystem.go Deterministically derives directory structure.
tsc/​internal/​api/​requestfilesystem/​requestfilesystem_test.go Tests host-aware casing behavior.
packages/​typescript/​test/​sync/​api.test.ts Updates synchronous API expectations.
packages/​typescript/​test/​async/​api.test.ts Updates asynchronous API expectations.
packages/​typescript/​src/​api/​proto.generated.ts Documents server-side derivation.
packages/​typescript/​src/​api/​path.ts Preserves casing during URI decoding.
packages/​typescript/​src/​api/​fs.ts Removes client-side directory inference.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread tsc/internal/ls/lsconv/converters_test.go
@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Sep 22, 2026
@andrewbranch

Copy link
Copy Markdown
Member Author

Your comment made me realize that there was still a path that went from file name to URI and back to file name. If either one of those conversions is intended to be lossy/case-normalizing, any API requests that can end up creating filenames on new source files shouldn't go through that. Fixed in the latest commit.

@andrewbranch
Andrew Branch (andrewbranch) added this pull request to the merge queue Sep 22, 2026
Merged via the queue into microsoft:main with commit 9774717 Sep 22, 2026
28 checks passed
@andrewbranch
Andrew Branch (andrewbranch) deleted the api/case-sensitivity branch September 22, 2026 20:53
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants