Fix hover/go-to-definition on vars, types, and methods (compound highlight spans) - #41
Open
bad33ndj3 wants to merge 1 commit into
Open
Fix hover/go-to-definition on vars, types, and methods (compound highlight spans)#41bad33ndj3 wants to merge 1 commit into
bad33ndj3 wants to merge 1 commit into
Conversation
GitLab's highlighter sometimes groups several tokens into one span (e.g. hljs-params wrapping an entire "(t *runAtTimerTask)" receiver, or a trailing span holding a method name plus its parens). caretElementMatchesIdentifier required the span's whole trimmed text to equal the identifier, so hover/go-to-definition silently failed on most vars, types, and methods while still working on package names (which usually sit alone in their own span). Now also accepts the identifier as a whole word within the span's text, guarded by identifier boundaries so it still rejects a caret snapping onto an adjacent identifier. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NbVVA6kUeVF2Kx8FJJVMsj
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.
Summary
caretElementMatchesIdentifierrequired a caret hit's DOM element to have trimmed text exactly equal to the identifier. GitLab's syntax highlighter frequently groups several tokens into one span — e.g.hljs-paramswraps an entire(t *runAtTimerTask)method receiver, and a trailing span often holds a method name plus its parens.gitlab-runner/commands/multi.go): package names mostly sit alone in their own span and matched fine; vars, types, and method names usually don't, so hover/go-to-definition silently failed for most of them ("GoLens could not identify a Go symbol on this diff line").Test plan
npm run check:syntaxnpm test(540/540 on main)hljs-paramsreceiver) plus a negative case (Timeris not a whole-word match insiderunAtTimerTask)🤖 Generated with Claude Code
https://claude.ai/code/session_01NbVVA6kUeVF2Kx8FJJVMsj