Repository navigation
Normalize URI-valued DocumentIdentifier inputs - #65646
Open
Andrew Branch (andrewbranch) wants to merge 2 commits into
Open
Andrew Branch (andrewbranch) wants to merge 2 commits into
Andrew Branch (andrewbranch) wants to merge 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The URI parser double-encodes escaped opaque file paths, causing document identifiers to resolve to the wrong filename.
1 open issue
What changed in this PR
This follow-up to #65591 aligns URI-valued API document identifiers with the language server’s URI normalization and validation.
Changes:
- Delegate URI-object decoding to
DocumentUri, leaving plain filename strings unchanged. - Normalize single-slash file URIs to the canonical
file:///form. - Add Go and TypeScript API tests for normalization, validation, and module resolution.
| File | Description |
|---|---|
tsc/internal/lsp/lsproto/lsp.go |
Normalize file URI host formatting. |
tsc/internal/lsp/lsproto/lsp_json_test.go |
Test single-slash and escaped file URIs. |
tsc/internal/api/proto.go |
Use shared URI decoding for document identifiers. |
tsc/internal/api/proto_test.go |
Cover URI normalization, invalid inputs, and resolved paths. |
packages/typescript/test/sync/api.test.ts |
Test synchronous resolution with equivalent URI forms. |
packages/typescript/test/async/api.test.ts |
Test asynchronous resolution with equivalent URI forms. |
Review effort: Balanced
Andrew Branch (andrewbranch)
marked this pull request as ready for review
November 24, 2026 00:42
Andrew Branch (andrewbranch)
requested a review
from Jake Bailey (jakebailey)
November 24, 2026 00:42
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Follow-up to #65591:
#65591 (comment)
#65591 (comment)
DocumentIdentifier.UnmarshalJSONFromcasts URI strings directly tolsproto.DocumentUri, bypassing its normalization and validation. Instead, delegate to(*lsproto.DocumentUri).UnmarshalJSONFromto do the proper URL parsing and validation.