Skip to content

Conversation

jupblb
Copy link
Member

@jupblb jupblb commented Sep 26, 2025

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.

Example signature documentation:

  • var x int
  • const y *string

Generating 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. :)

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
- 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
@jupblb jupblb changed the title //Add type information to local variables in SCIP index Add type information to local variables in SCIP index 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
@jupblb jupblb merged commit 64e1dd6 into main Sep 29, 2025
4 checks passed
@jupblb jupblb deleted the michal/OSS-24122-2 branch September 29, 2025 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants