Skip to content

Make definition lookup mode configurable#45

Open
petr-popov wants to merge 3 commits intoktnyt:mainfrom
petr-popov:main
Open

Make definition lookup mode configurable#45
petr-popov wants to merge 3 commits intoktnyt:mainfrom
petr-popov:main

Conversation

@petr-popov
Copy link
Copy Markdown

Summary

This change adds per-server definition_mode to cclsp config.

Supported values:

  • symbol (default): existing behavior using symbol_name and optional symbol_kind
  • position: direct go-to-definition using line and character

Motivation

The existing name-based find_definition behavior works well for some languages and LLM workflows, but it does not work well for Kotlin/Java go-to-definition from a usage site. In those cases, definition lookup should start
from a concrete cursor position instead of trying to resolve a declaration by name inside the current file.

Changes

  • add definition_mode?: "position" | "symbol" to server config
  • default to symbol for backward compatibility
  • add LSPClient.getDefinitionMode(filePath)
  • update find_definition to branch by server definition_mode
  • keep existing symbol-based behavior unchanged for default mode
  • add tests for both position and symbol modes
  • update README with config and usage examples

Validation

  • npx tsc --noEmit
  • verified Kotlin find_definition from usage positions with definition_mode: "position"

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.

1 participant