Add type information to local variables in SCIP index#169
Merged
Conversation
For all local symbols (local variables, parameters, etc.), include their Go type information in the SymbolInformation.SignatureDocumentation field. This allows code intelligence features like hover tooltips to show the type of local variables without needing to jump to their definitions. The implementation: - Extends localSymbolInfo struct to store type information alongside symbol ID - Updates createNewLocalSymbol to extract type from types.Object - Includes type string in SignatureDocumentation for each local symbol - Adds display names for better readability in UI Cherry-picked from 980222947666047d464c4b236418b09a53f2f056 (excluding tests) Amp-Thread-ID: https://ampcode.com/threads/T-e6feb9ee-1c7e-4b0b-957e-80033288d4d7
8cbb60d to
a537585
Compare
varungandhi-src
suggested changes
Sep 29, 2025
- Move LocalSymbolInfo (renamed to Local) from visitors to lookup package for better package organization alongside Global and Package - Store types.Object directly instead of extracting fields upfront - Extract type information lazily in SignatureText() method - Cleaner separation of concerns and more maintainable code The refactoring preserves all existing functionality while improving code organization and reducing complexity in visitor_file.go Amp-Thread-ID: https://ampcode.com/threads/T-654bed0b-94e2-4563-a7fd-d730d7eb28d9
varungandhi-src
approved these changes
Sep 29, 2025
- Pass the actual types.PkgName object when creating local symbols for import aliases - Update SignatureText to handle PkgName objects: adds 'import' prefix and shows package path - Now import aliases display as 'import foo fmt' instead of just empty or invalid type Amp-Thread-ID: https://ampcode.com/threads/T-6978c85f-14b7-46c8-ab55-9b642e013371
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.
For all local symbols (local variables, parameters, etc.), include their Go type information in the
SymbolInformation.SignatureDocumentationfield. This allows code intelligence features like hover tooltips to show the type of local variables without needing to jump to their definitions.Example signature documentation:
var x intconst y *stringGenerating index this way is already compatible with Sourcegraph's code search so feel free to upload index generated with this change and see what the hovers look like. :)