Skip to content

feat(lsp): add definition and references methods to LSPManager#14

Merged
amondnet merged 1 commit into
mainfrom
13-add-definition-and-references-methods-to-lspmanager
Dec 18, 2025
Merged

feat(lsp): add definition and references methods to LSPManager#14
amondnet merged 1 commit into
mainfrom
13-add-definition-and-references-methods-to-lspmanager

Conversation

@amondnet

Copy link
Copy Markdown
Contributor

Summary

Adds essential LSP code navigation features to LSPManager: definition() and references() methods. These enable IDEs and editors to provide "Go to Definition" and "Find All References" functionality.

Changes

  • definition(): Navigate to where a symbol is defined (LSP textDocument/definition request)
  • references(): Find all references to a symbol (LSP textDocument/references request)
  • Implements LSP 3.17 specification compliance
  • Supports multiple response formats:
    • Location
    • Location[]
    • LocationLink[] (with origin information)
  • Includes type guards for runtime type checking
  • Normalizes location responses for consistent API

Implementation Details

Both methods:

  • Accept file path, line, and character position parameters
  • Query all available LSP clients for the file
  • Handle different response types through type normalization
  • Return normalized Location[] format for consistent consumption
  • Include error handling and graceful degradation

Test Plan

  • New methods added to LSPManager class
  • Methods follow LSP 3.17 specification
  • Response format handling verified (Location, Location[], LocationLink[])
  • Type definitions added for response schemas
  • Exported from public API

Related Issues

Closes #13

Add essential LSP code navigation features:
- definition(): Go to definition (textDocument/definition)
- references(): Find all references (textDocument/references)

Follows LSP 3.17 specification with support for:
- Location, Location[], and LocationLink[] response formats
- Type guards for runtime type checking

Closes #13
@amondnet amondnet linked an issue Dec 18, 2025 that may be closed by this pull request
7 tasks
@amondnet amondnet merged commit 45e82f3 into main Dec 18, 2025
3 checks passed
@amondnet amondnet deleted the 13-add-definition-and-references-methods-to-lspmanager branch December 18, 2025 05:43
@passionfactory-bot passionfactory-bot Bot mentioned this pull request Dec 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add definition and references methods to LSPManager

1 participant