Skip to content

Fix Cmd+click navigating to file instead of definition#49012

Merged
SomeoneToIgnore merged 1 commit intozed-industries:mainfrom
chenwuji2000-cyber:fix/hover-link-false-file-match
Feb 27, 2026
Merged

Fix Cmd+click navigating to file instead of definition#49012
SomeoneToIgnore merged 1 commit intozed-industries:mainfrom
chenwuji2000-cyber:fix/hover-link-false-file-match

Conversation

@chenwuji2000-cyber
Copy link
Copy Markdown
Contributor

@chenwuji2000-cyber chenwuji2000-cyber commented Feb 12, 2026

Summary

  • Tighten link_pattern_file_candidates regex from \(([^)]*)\) to ]\(([^)]*)\) so only Markdown link syntax [title](path) triggers path extraction from parentheses
  • Prevents function call arguments like do_work(file2) from being incorrectly resolved as file paths, which preempted LSP go-to-definition

Closes #48938

Test plan

  • cargo test -p editor hover_links — all 12 tests pass
  • New unit tests verify: function calls don't extract arguments as file candidates; Markdown links still extract correctly

🤖 Generated with Claude Code

Release Notes:

  • Fixed Cmd+click navigating to file instead of definition in certain cases

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Feb 12, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @Bug93 on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@zed-community-bot zed-community-bot bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Feb 12, 2026
@chenwuji2000-cyber chenwuji2000-cyber force-pushed the fix/hover-link-false-file-match branch from 7c96da6 to 5a0cec9 Compare February 12, 2026 09:45
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 12, 2026
@SomeoneToIgnore SomeoneToIgnore self-assigned this Feb 24, 2026
The `link_pattern_file_candidates` regex `\(([^)]*)\)` was intended to
extract paths from Markdown links like `[title](path.md)`, but it
matched any parenthesized content, including function call arguments.
This caused `find_file` to incorrectly resolve e.g. `file2` from
`do_work(file2)` as `file2.rs`, preempting LSP go-to-definition.

Tighten the regex to `]\(([^)]*)\)` so only Markdown link syntax
triggers path extraction.

Release Notes:

- Fixed Cmd+click (go-to-definition) incorrectly navigating to a file instead of the symbol definition when the hovered text contains parenthesized content resembling a file path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@chenwuji2000-cyber chenwuji2000-cyber force-pushed the fix/hover-link-false-file-match branch from 5a0cec9 to 55c0ed8 Compare February 27, 2026 03:50
Copy link
Copy Markdown
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@SomeoneToIgnore SomeoneToIgnore merged commit 96abd03 into zed-industries:main Feb 27, 2026
29 checks passed
rtfeldman pushed a commit that referenced this pull request Feb 27, 2026
## Summary

- Tighten `link_pattern_file_candidates` regex from `\(([^)]*)\)` to
`]\(([^)]*)\)` so only Markdown link syntax `[title](path)` triggers
path extraction from parentheses
- Prevents function call arguments like `do_work(file2)` from being
incorrectly resolved as file paths, which preempted LSP go-to-definition

Closes #48938

## Test plan

- [x] `cargo test -p editor hover_links` — all 12 tests pass
- [x] New unit tests verify: function calls don't extract arguments as
file candidates; Markdown links still extract correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Release Notes:

- Fixed Cmd+click navigating to file instead of definition in certain
cases

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
tahayvr pushed a commit to tahayvr/zed that referenced this pull request Mar 4, 2026
…s#49012)

## Summary

- Tighten `link_pattern_file_candidates` regex from `\(([^)]*)\)` to
`]\(([^)]*)\)` so only Markdown link syntax `[title](path)` triggers
path extraction from parentheses
- Prevents function call arguments like `do_work(file2)` from being
incorrectly resolved as file paths, which preempted LSP go-to-definition

Closes zed-industries#48938

## Test plan

- [x] `cargo test -p editor hover_links` — all 12 tests pass
- [x] New unit tests verify: function calls don't extract arguments as
file candidates; Markdown links still extract correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Release Notes:

- Fixed Cmd+click navigating to file instead of definition in certain
cases

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
naaiyy pushed a commit to Glass-HQ/Glass that referenced this pull request Mar 10, 2026
…s#49012)

## Summary

- Tighten `link_pattern_file_candidates` regex from `\(([^)]*)\)` to
`]\(([^)]*)\)` so only Markdown link syntax `[title](path)` triggers
path extraction from parentheses
- Prevents function call arguments like `do_work(file2)` from being
incorrectly resolved as file paths, which preempted LSP go-to-definition

Closes zed-industries#48938

## Test plan

- [x] `cargo test -p editor hover_links` — all 12 tests pass
- [x] New unit tests verify: function calls don't extract arguments as
file candidates; Markdown links still extract correctly

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Release Notes:

- Fixed Cmd+click navigating to file instead of definition in certain
cases

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go to definition takes me to a different file and does not call the language server

2 participants