Files
cleveragents-core/features/lsp_tool_adapter_coverage.feature
hamza.khyari c200fe0f86
CI / lint (push) Successful in 18s
CI / unit_tests (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / build (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / security (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / helm (push) Has been cancelled
CI / quality (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CI / docker (push) Has been cancelled
feat(lsp): implement get_hover and get_definitions for LSP runtime (#1240)
Add hover and definition support to LspClient and LspRuntime.

- LspClient.get_hover(): sends textDocument/hover, returns Hover dict or None
- LspClient.get_definitions(): sends textDocument/definition, handles
  Location, Location[], and LocationLink[] responses
- LspRuntime wrappers: input validation, file reading, language
  detection, 1-based to 0-based line/column conversion
- try/finally for did_close() safety on both new methods
- Tool adapter: HOVER and DEFINITIONS dispatch to runtime instead of
  raising LspNotAvailableError
- Updated lsp_tool_adapter_coverage test (HOVER -> REFERENCES)
- 21 Behave BDD scenarios with full path coverage

Closes #1243

Co-authored-by: Hamza Khyari <hamza.khyari@cleverthis.com>
Co-committed-by: Hamza Khyari <hamza.khyari@cleverthis.com>
2026-04-02 16:52:33 +00:00

49 lines
2.5 KiB
Gherkin

Feature: LSP Tool Adapter uncovered-line coverage
Exercise runtime-handler branches, workspace-symbols paths,
missing-argument guards, and the None-config check in
LspToolAdapter.generate_tool_specs (tool_adapter.py lines
126-153 and 198).
Scenario: ltacov generate_tool_specs raises ValueError when config is None
Given ltacov an LspToolAdapter with no runtime
When ltacov generate_tool_specs is called with None config
Then ltacov a ValueError with message "config must not be None" is raised
Scenario: ltacov workspace-symbols handler returns error when query is empty
Given ltacov a mock LspRuntime
And ltacov a runtime handler for workspace_symbols capability
When ltacov the handler is called with no query argument
Then ltacov the result is an error dict saying "query is required"
Scenario: ltacov workspace-symbols handler raises LspNotAvailableError with valid query
Given ltacov a mock LspRuntime
And ltacov a runtime handler for workspace_symbols capability
When ltacov the handler is called with query "MyClass"
Then ltacov an LspNotAvailableError is raised mentioning "workspace_symbols"
Scenario: ltacov runtime handler returns error when file_path is missing
Given ltacov a mock LspRuntime
And ltacov a runtime handler for diagnostics capability
When ltacov the handler is called with no file_path argument
Then ltacov the result is an error dict saying "file_path is required"
Scenario: ltacov runtime handler delegates diagnostics to runtime
Given ltacov a mock LspRuntime
And ltacov the runtime get_diagnostics returns sample items
And ltacov a runtime handler for diagnostics capability
When ltacov the handler is called with file_path "src/main.py"
Then ltacov the result contains a "diagnostics" key with the sample items
Scenario: ltacov runtime handler delegates completions to runtime
Given ltacov a mock LspRuntime
And ltacov the runtime get_completions returns sample items
And ltacov a runtime handler for completions capability
When ltacov the handler is called with file_path "src/main.py" line 10 column 5
Then ltacov the result contains a "completions" key with the sample items
Scenario: ltacov runtime handler raises LspNotAvailableError for unimplemented capability
Given ltacov a mock LspRuntime
And ltacov a runtime handler for references capability
When ltacov the handler is called with file_path "src/main.py"
Then ltacov an LspNotAvailableError is raised mentioning "references"