feat(lsp): implement get_hover and get_definitions for LSP runtime (#1240)
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
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
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>
This commit was merged in pull request #1240.
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
@lsp-hover-definitions
|
||||
Feature: LSP hover and definitions methods
|
||||
Verifies that LspClient and LspRuntime implement get_hover
|
||||
and get_definitions with full path coverage.
|
||||
|
||||
# ── LspClient method existence ─────────────────────────
|
||||
|
||||
Scenario: LspClient has get_hover method for lsp_hd
|
||||
Then LspClient should have a "get_hover" method for lsp_hd
|
||||
|
||||
Scenario: LspClient has get_definitions method for lsp_hd
|
||||
Then LspClient should have a "get_definitions" method for lsp_hd
|
||||
|
||||
# ── LspClient get_hover paths ──────────────────────────
|
||||
|
||||
Scenario: LspClient get_hover returns dict result for lsp_hd
|
||||
When I call LspClient.get_hover with mock returning a dict for lsp_hd
|
||||
Then the hover result should be a dict for lsp_hd
|
||||
|
||||
Scenario: LspClient get_hover returns None when server returns null for lsp_hd
|
||||
When I call LspClient.get_hover with mock returning null for lsp_hd
|
||||
Then the hover result should be None for lsp_hd
|
||||
|
||||
Scenario: LspClient get_hover returns None for unexpected type for lsp_hd
|
||||
When I call LspClient.get_hover with mock returning an integer for lsp_hd
|
||||
Then the hover result should be None for lsp_hd
|
||||
|
||||
# ── LspClient get_definitions paths ────────────────────
|
||||
|
||||
Scenario: LspClient get_definitions returns list of Locations for lsp_hd
|
||||
When I call LspClient.get_definitions with mock returning a list for lsp_hd
|
||||
Then the definitions result should be a list with 1 item for lsp_hd
|
||||
|
||||
Scenario: LspClient get_definitions wraps single Location in list for lsp_hd
|
||||
When I call LspClient.get_definitions with mock returning a single dict for lsp_hd
|
||||
Then the definitions result should be a list with 1 item for lsp_hd
|
||||
|
||||
Scenario: LspClient get_definitions returns empty list for null for lsp_hd
|
||||
When I call LspClient.get_definitions with mock returning null for lsp_hd
|
||||
Then the definitions result should be an empty list for lsp_hd
|
||||
|
||||
Scenario: LspClient get_definitions returns empty for unexpected type for lsp_hd
|
||||
When I call LspClient.get_definitions with mock returning an integer for lsp_hd
|
||||
Then the definitions result should be an empty list for lsp_hd
|
||||
|
||||
# ── LspRuntime method existence ────────────────────────
|
||||
|
||||
Scenario: LspRuntime has get_hover method for lsp_hd
|
||||
Then LspRuntime should have a "get_hover" method for lsp_hd
|
||||
|
||||
Scenario: LspRuntime has get_definitions method for lsp_hd
|
||||
Then LspRuntime should have a "get_definitions" method for lsp_hd
|
||||
|
||||
# ── LspRuntime input validation ────────────────────────
|
||||
|
||||
Scenario: LspRuntime get_hover rejects empty name for lsp_hd
|
||||
When I call LspRuntime.get_hover with empty name for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "name"
|
||||
|
||||
Scenario: LspRuntime get_hover rejects empty file_path for lsp_hd
|
||||
When I call LspRuntime.get_hover with empty file_path for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "file_path"
|
||||
|
||||
Scenario: LspRuntime get_hover rejects line 0 for lsp_hd
|
||||
When I call LspRuntime.get_hover with line 0 for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "line"
|
||||
|
||||
Scenario: LspRuntime get_hover rejects column 0 for lsp_hd
|
||||
When I call LspRuntime.get_hover with column 0 for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "column"
|
||||
|
||||
Scenario: LspRuntime get_definitions rejects empty name for lsp_hd
|
||||
When I call LspRuntime.get_definitions with empty name for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "name"
|
||||
|
||||
Scenario: LspRuntime get_definitions rejects empty file_path for lsp_hd
|
||||
When I call LspRuntime.get_definitions with empty file_path for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "file_path"
|
||||
|
||||
Scenario: LspRuntime get_definitions rejects line 0 for lsp_hd
|
||||
When I call LspRuntime.get_definitions with line 0 for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "line"
|
||||
|
||||
Scenario: LspRuntime get_definitions rejects column 0 for lsp_hd
|
||||
When I call LspRuntime.get_definitions with column 0 for lsp_hd
|
||||
Then a ValueError should be raised for lsp_hd with message "column"
|
||||
|
||||
# ── Tool adapter wiring ────────────────────────────────
|
||||
|
||||
Scenario: Tool adapter maps HOVER capability for lsp_hd
|
||||
Then the tool adapter capability map should include "hover" for lsp_hd
|
||||
|
||||
Scenario: Tool adapter maps DEFINITIONS capability for lsp_hd
|
||||
Then the tool adapter capability map should include "definitions" for lsp_hd
|
||||
Reference in New Issue
Block a user