6a8f724299
CI / build (pull_request) Successful in 18s
CI / security (pull_request) Successful in 58s
CI / lint (pull_request) Successful in 3m19s
CI / typecheck (pull_request) Successful in 3m54s
CI / quality (pull_request) Successful in 3m55s
CI / integration_tests (pull_request) Successful in 6m49s
CI / unit_tests (pull_request) Successful in 7m3s
CI / docker (pull_request) Successful in 1m6s
CI / e2e_tests (pull_request) Successful in 11m45s
CI / benchmark-publish (pull_request) Has been skipped
CI / coverage (pull_request) Successful in 12m52s
CI / status-check (pull_request) Successful in 2s
CI / benchmark-regression (pull_request) Successful in 58m46s
Align LspCapability enum with the spec's 11-capability set
(docs/specification.md lines 20705-20717):
Renamed: TYPE_INFO -> HOVER, SYMBOLS -> DOCUMENT_SYMBOLS,
FORMAT -> FORMATTING
Added: DEFINITIONS, SIGNATURE_HELP, WORKSPACE_SYMBOLS
Updated LspToolAdapter._CAPABILITY_TOOL_MAP (11 entries):
- code_actions suffix -> code-actions (hyphen per spec)
- RENAME gets dedicated schema with new_name parameter
- workspace_symbols gets query-based schema
Updated _input_schema_for() with 4 schema categories extracted
to module-level constants: file-only, position-based, rename
(with new_name), and query-based. Added defensive ValueError for
unmapped capabilities. Added additionalProperties: false.
Extended LspClient.initialize() to advertise all 11 capabilities
in the initialize request (hover, definition, references, rename,
codeAction, formatting, signatureHelp, documentSymbol, workspace
symbol).
Fixed _make_runtime_handler() to handle workspace_symbols as
query-only input (no file_path required), resolving the
schema/handler contract mismatch.
Fixed stale references: type_info -> hover, symbols ->
document_symbols in test fixtures, feature files, CLI docstring.
Updated docs/reference/lsp.md and CHANGELOG.md.
Behave tests (38 scenarios): enum completeness, tool spec generation
with structural validation, input schema per category, all 11
stubbed provider keys, negative tests for invalid capability and
defensive ValueError branch.
ISSUES CLOSED: #834
123 lines
5.1 KiB
Gherkin
123 lines
5.1 KiB
Gherkin
@lsp @capability
|
|
Feature: LspCapability Enum Completeness
|
|
As a developer integrating LSP servers
|
|
I want the LspCapability enum to include all spec-defined capabilities
|
|
So that the tool adapter generates correct tool specs
|
|
|
|
# ── Enum completeness ──────────────────────────────────────
|
|
|
|
Scenario: LspCapability enum has exactly 11 members
|
|
Given the LspCapability enum for lsp_cap
|
|
Then the lsp_cap enum should have 11 members
|
|
|
|
Scenario Outline: LspCapability enum includes <member>
|
|
Given the LspCapability enum for lsp_cap
|
|
Then the lsp_cap enum should include "<member>"
|
|
|
|
Examples:
|
|
| member |
|
|
| diagnostics |
|
|
| hover |
|
|
| completions |
|
|
| definitions |
|
|
| references |
|
|
| rename |
|
|
| code_actions |
|
|
| formatting |
|
|
| signature_help |
|
|
| document_symbols |
|
|
| workspace_symbols |
|
|
|
|
# ── Tool adapter generates specs for all capabilities ──────
|
|
|
|
Scenario: Tool adapter has mappings for all 11 capabilities
|
|
Given the lsp_cap capability tool map
|
|
Then the lsp_cap tool map should have 11 entries
|
|
|
|
Scenario Outline: Tool adapter generates tool spec for <capability>
|
|
Given an LspServerConfig with capability "<capability>" for lsp_cap
|
|
When I generate tool specs for lsp_cap
|
|
Then the lsp_cap generated specs should not be empty
|
|
And the lsp_cap tool spec should have keys "name" and "input_schema"
|
|
And the lsp_cap tool name should end with "<tool_suffix>"
|
|
|
|
Examples:
|
|
| capability | tool_suffix |
|
|
| diagnostics | diagnostics |
|
|
| hover | hover |
|
|
| completions | completions |
|
|
| definitions | definition |
|
|
| references | references |
|
|
| rename | rename |
|
|
| code_actions | code-actions |
|
|
| formatting | format |
|
|
| signature_help | signature |
|
|
| document_symbols | symbols |
|
|
| workspace_symbols | workspace-symbols |
|
|
|
|
# ── Input schemas per category ─────────────────────────────
|
|
|
|
Scenario Outline: File-only capability <cap> has file_path schema
|
|
Given the lsp_cap input schema for "<cap>"
|
|
Then the lsp_cap schema should require "file_path"
|
|
And the lsp_cap schema should not require "line"
|
|
|
|
Examples:
|
|
| cap |
|
|
| diagnostics |
|
|
| formatting |
|
|
| document_symbols |
|
|
|
|
Scenario Outline: Position capability <cap> has file+line+column schema
|
|
Given the lsp_cap input schema for "<cap>"
|
|
Then the lsp_cap schema should require "file_path"
|
|
And the lsp_cap schema should require "line"
|
|
And the lsp_cap schema should require "column"
|
|
|
|
Examples:
|
|
| cap |
|
|
| hover |
|
|
| completions |
|
|
| definitions |
|
|
| references |
|
|
| code_actions |
|
|
| signature_help |
|
|
|
|
Scenario: Rename capability has file+line+column+new_name schema
|
|
Given the lsp_cap input schema for "rename"
|
|
Then the lsp_cap schema should require "file_path"
|
|
And the lsp_cap schema should require "line"
|
|
And the lsp_cap schema should require "column"
|
|
And the lsp_cap schema should require "new_name"
|
|
|
|
Scenario: Workspace symbols has query schema
|
|
Given the lsp_cap input schema for "workspace_symbols"
|
|
Then the lsp_cap schema should require "query"
|
|
And the lsp_cap schema should not require "file_path"
|
|
|
|
# ── Stubbed server capabilities include all keys ───────────
|
|
|
|
Scenario: Stubbed server capabilities include all LSP providers
|
|
Given the lsp_cap stubbed server capabilities
|
|
Then the lsp_cap stubbed caps should include "hoverProvider"
|
|
And the lsp_cap stubbed caps should include "definitionProvider"
|
|
And the lsp_cap stubbed caps should include "signatureHelpProvider"
|
|
And the lsp_cap stubbed caps should include "documentSymbolProvider"
|
|
And the lsp_cap stubbed caps should include "workspaceSymbolProvider"
|
|
And the lsp_cap stubbed caps should include "completionProvider"
|
|
And the lsp_cap stubbed caps should include "referencesProvider"
|
|
And the lsp_cap stubbed caps should include "renameProvider"
|
|
And the lsp_cap stubbed caps should include "codeActionProvider"
|
|
And the lsp_cap stubbed caps should include "documentFormattingProvider"
|
|
And the lsp_cap stubbed caps should include "diagnosticProvider"
|
|
|
|
# ── Negative tests ─────────────────────────────────────────
|
|
|
|
Scenario: Invalid capability value raises ValueError
|
|
When I create an LspCapability with value "nonexistent" for lsp_cap
|
|
Then the lsp_cap creation should raise a ValueError
|
|
|
|
Scenario: _input_schema_for raises ValueError for unknown capability
|
|
When I call _input_schema_for with a fake capability for lsp_cap
|
|
Then the lsp_cap schema call should raise a ValueError
|