Skip to content

fix(preview): find a bare .md name printed from another folder - #66

Merged
arifintahu merged 1 commit into
mainfrom
fix/preview-bare-name-in-subfolder
Nov 24, 2026
Merged

arifintahu merged 1 commit into
mainfrom
fix/preview-bare-name-in-subfolder

Conversation

@arifintahu

Copy link
Copy Markdown
Member

What and why

Ctrl+click on a Markdown file name printed by ls docs/ showed "file not found". ls docs/ prints spec.md relative to docs/, but the name was resolved against the pane's folder, and the output does not say which folder it came from.

When a bare name (no /, \, ~ or :) is missing from the pane's folder, preview_resolve now looks below that folder and opens the single shallowest match. The search is bounded: 3 levels, 400 folders, skips hidden folders, node_modules, target and vendor, and never follows symlinks. Two matches at the same depth stay "file not found" rather than guessing. Names that include a folder resolve as before, and the existing network-path guard (ensure_local) runs before any search.

Known gaps: a file more than 3 levels below the pane's folder is still not found.

How you checked it

/ci on Windows, all passing:

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (159 passed)

  • pnpm turbo check test build (Vitest 442 passed), pnpm version:check

  • Not tried by hand in the running app.

  • cargo fmt --check, cargo clippy -- -D warnings and cargo test pass

  • pnpm turbo check test build and pnpm version:check pass

  • Bug fixes have a test that failed before the fix (the tests were written together with the fix; I did not run them without it)

  • No secrets, personal paths or machine names in the diff

  • Docs and CHANGELOG.md updated if behaviour changed

`ls docs/` prints `spec.md` relative to docs/, but the name was resolved
against the pane's folder, so Ctrl+click reported "file not found". When a
bare name is missing there, look below the pane's folder (3 levels, 400
folders, no hidden/dependency folders, no symlinks) and open the single
shallowest match; ambiguous names still fail.
@arifintahu
arifintahu merged commit 8561035 into main Nov 24, 2026
4 checks passed
@arifintahu
arifintahu deleted the fix/preview-bare-name-in-subfolder branch November 24, 2026 14:29
@arifintahu arifintahu mentioned this pull request Nov 25, 2026
4 of 5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant