feat: add global variable symbols to workspace search#37
Open
harshatba wants to merge 1 commit into
Open
Conversation
Extends symbol indexing to include module-level variable definitions, making them searchable via workspace symbol search (Cmd+T). Changes: - Add `Variable` variant to `SymbolKind` enum - Update LSP handler to map Variable to LspSymbolKind::VARIABLE - Implement assignment extraction in tree-sitter parser - Handles simple assignments (MY_VAR = 42) - Handles annotated assignments (name: str = "hello") - Handles tuple unpacking (x, y = 1, 2) - Handles chained assignments (a = b = 10) - Implement assignment extraction in Ruff parser with same support - Add comprehensive unit and integration tests - Create test fixture with positive and negative cases Only module-level variables are indexed; local variables and class attributes are excluded to avoid cluttering search results. All 57 tests pass (28 unit + 27 integration + 2 parallel indexing). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fe45676 to
6fa5c02
Compare
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
Extends symbol indexing to include module-level variable definitions, making them searchable via workspace symbol search (Cmd+T / Ctrl+T).
Changes
Variablevariant toSymbolKindenumLspSymbolKind::VARIABLEMY_VAR = 42name: str = "hello",server: strx, y = 1, 2a = b = 10Behavior
Test Plan
All 57 tests pass:
Both parser backends (tree-sitter and ruff) produce matching results.
Testing Locally
cd pylight && cargo build --releasecp pylight/target/release/pylight pydance/cd pydance && npx @vscode/vsce packagecode --install-extension pydance-*.vsix🤖 Generated with Claude Code