Skip to content

fix(goto-file): fall back after unresolved document links - #16220

Open
yiheng-kkk wants to merge 1 commit into
helix-editor:masterfrom
yiheng-kkk:fix/goto-file-unresolved-document-link
Open

fix(goto-file): fall back after unresolved document links#16220
yiheng-kkk wants to merge 1 commit into
helix-editor:masterfrom
yiheng-kkk:fix/goto-file-unresolved-document-link

Conversation

@yiheng-kkk

Copy link
Copy Markdown

Closes #15586.

Summary

goto_file currently treats any overlapping LSP document link as a complete match. If that link has no target and cannot be resolved, the built-in path fallback is skipped, so gf does nothing instead of opening a new buffer for the selected path.

This change preserves document-link precedence while falling back when a link has no usable target:

  • links without a resolver use the built-in fallback immediately;
  • resolver errors and target: None fall back after resolution;
  • any valid target suppresses fallback for that selection;
  • repeated links across selections are resolved once, and targets and fallback paths are deduplicated to avoid repeated jumps or splits.

The fallback path is captured before the asynchronous resolve so it still reflects the selection that invoked goto_file.

Validation

  • cargo fmt --all -- --check
  • cargo check -p helix-term --features integration
  • 8 focused document-link state-machine tests
  • 4 focused goto_file integration tests
  • cargo test --workspace
  • cargo integration-test — 180 passed
  • cargo clippy --workspace --all-targets -- -D warnings
  • git diff --check

The test/build commands used Helix's supported HELIX_DISABLE_AUTO_GRAMMAR_BUILD=1 setting with the repository grammars already cached, because GitHub was temporarily timing out while fetching one unrelated grammar.

AI disclosure

This change was developed with assistance from OpenAI Codex. The final implementation, tests, asynchronous resolution semantics, repository history, and contribution policy were independently reviewed before submission.

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.

goto_file can no longer create new files.

1 participant