Skip to content

fix(ls): list open documents that are not on disk in path completions - #1062

Merged
camc314 merged 2 commits into
oxc-project:mainfrom
magurotuna:fix/ls-path-completion-base-directory
Nov 21, 2026
Merged

camc314 merged 2 commits into
oxc-project:mainfrom
magurotuna:fix/ls-path-completion-base-directory

Conversation

@magurotuna

Copy link
Copy Markdown
Member

Path completion did not list files that are open in the editor but not saved to disk:

// a.ts is on disk; virt.ts is open in the editor only
import {} from "./";  // tsgo: a, virt    tsrs: a

Go resolves the directory with ResolveDirectory, which removes the trailing /, and the overlay file system looks up directories in that form. tsrs kept the /, so it missed the open files. This PR uses tspath::resolve_file. It also ports Go's RelativeTo for typesVersions packages, because the old code there needed the /.

Tests: overlay_files_missing_from_path_completions in tsrs_cli.

AI assistance: written with Claude Code.

Path completion did not list files that are open in the editor but not saved
to disk:

```ts
// a.ts is on disk; virt.ts is open in the editor only
import {} from "./";  // tsgo: a, virt    tsrs: a
```

Go resolves the directory with `ResolveDirectory`
(`ls/string_completions.go:1278`), which removes the trailing `/`, and the
overlay file system looks up directories in that form. tsrs kept the `/`, so
it missed the open files. Use `tspath::resolve_file`. It also ports Go's
`RelativeTo` for `typesVersions` packages, because the old code there needed
the `/`.

Tests: `overlay_files_missing_from_path_completions` in `tsrs_cli`.

AI assistance: written with Claude Code.
@codspeed

codspeed Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 8 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing magurotuna:fix/ls-path-completion-base-directory (ddc55e0) with main (5559a85)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

…n-base-directory

# Conflicts:
#	crates/tsrs_cli/tests/integration/main.rs
@camc314
camc314 added this pull request to the merge queue Nov 21, 2026
Merged via the queue into oxc-project:main with commit a2898df Nov 21, 2026
69 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants