refactor(web): detect hoverable symbols via Lezer highlight tags#1194
Merged
brendan-kellam merged 2 commits intoMay 12, 2026
Merged
Conversation
Replaces the hand-maintained NODE_TYPES list in symbolHoverTargetsExtension with a tag-based check that asks each node's highlight tag whether it descends from `tags.name`. This is the same vocabulary every CodeMirror grammar already uses for syntax highlighting, so identifier coverage now follows the grammar authors' classification instead of a guess-driven cross-product of node names. Side effects worth noting: - Picks up C/C++ TypeIdentifier nodes that the old list missed (return types, parameter types, base classes). - Picks up modifier-wrapped variants like `definition(variableName)` and `local(variableName)` automatically. - Adds C/C++ aliasing to the language filter in codeNav api.ts so search-based goto-definition resolves across both. Also adds vitest coverage exercising identifier detection in TypeScript+JSX, Python, Go, Rust, Java, C++, and PHP with positive and negative assertions (expected identifiers present, keywords/punctuation absent). Fixes SOU-1077 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
WalkthroughThe PR refactors symbol hover target detection to use Lezer highlight tags instead of hardcoded node types for broader identifier coverage, adds comprehensive multi-language test validation, enhances C/C++ language filtering, and updates the changelog. ChangesSymbol hover targets detection
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment has been minimized.
This comment has been minimized.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Fixes SOU-1077
Summary
NODE_TYPESlist insymbolHoverTargetsExtensionwith a tag-based check that asks each node's highlight tag whether it descends fromtags.name— the same vocabulary every CodeMirror grammar already uses for syntax highlighting. New grammars now work for free; the previously-missed C++TypeIdentifier(return types, parameter types, base classes) is now detected, along with modifier-wrapped variants likedefinition(variableName).codeNav/api.tsso search-based goto-definition resolves across both languages.Test plan
yarn workspace @sourcebot/web vitest run src/ee/features/codeNav/components/symbolHoverPopup/symbolHoverTargetsExtension.test.ts— all 9 language tests passTypeIdentifierwas missed)🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests