Repository navigation
fix(vfs): port the include base path computation from Go - #1052
Merged
camc314 merged 1 commit intoNov 20, 2026
Merged
Conversation
`get_base_paths` and `get_include_base_path` compute the directories that the `include` walk starts from. Two steps differed from Go's `getBasePaths` and `getIncludeBasePath` (`vfsmatch.go`): - `get_base_paths` kept an absolute include entry as written. Go normalizes it first. So `<shared>/./*.ts` (outside the project) started the walk at `<shared>/./`, and no visited name matched the normalized include pattern (TS18003). `<shared>/sub/..` walked only `sub`. - `get_include_base_path` cut the path at the last `/` before the first wildcard. Go keeps at least the root (`max(LastIndex(...), GetRootLength(absolute))`). So `^/*` gave the base path `^`, which `contains_path` treats as relative and inside the project, and the walk never visited `^/`. This change ports both expressions as they are, and wraps the base path in `get_normalized_absolute_path(.., path)` and `ensure_rooted_path_root_separator`, as Go's `ToRootedDirectoryPath(getIncludeBasePath(absolute), path)` does. Tests: `include_rooted_dot_segments` in the `tsrs_cli` integration tests (the expected output names a file outside the project, so the test builds the project at run time) and the regression case `include-wildcard-below-caret-root`. Expected results are from tsgo at the pinned commit. All fail without the fix. AI assistance: written with Claude Code.
camc314
approved these changes
Nov 20, 2026
Contributor
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
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.
tsrs missed files for two kinds of
includeentries:.or..segment, such as<abs>/shared/./*.ts: tsrs found no files (TS18003), where tsgo compiles../shared/a.ts. For<abs>/shared/sub/.., tsrs found only the files belowsub."include": ["^/*"]with the file^/a.ts: tsgo compiles^/a.ts, and tsrs found no files.Go
getBasePathsnormalizes an absolute entry before it takes the base path of the walk, andgetIncludeBasePathkeeps at least the root (^/, not^). tsrs skipped both steps. This PR ports them, and wraps the base path as Go'sToRootedDirectoryPathdoes.Tests:
include_rooted_dot_segmentsand theinclude-wildcard-below-caret-rootregression. All fail without the fix.AI assistance: written with Claude Code.