Repository navigation
Closed
Labels
area/specs.t27 spec files and conformance.t27 spec files and conformanceenhancementNew feature or requestNew feature or requestspec
Description
The code action framework: the lightbulb. This module owns the protocol side only (kinds, filtering, preferred and disabled actions, lazy edits, resolve, commands); the actions themselves come from the modules for use hygiene (specs/lsp/use_actions.t27), refactorings (specs/lsp/refactor.t27) and lint fixes (specs/lsp/lint.t27). Part of the LSP epic, Refs #12209 (wave 1, standard features). Only .t27: no code in any other language, not even scratch probes or a loader; see skill only-t27.
Prior art:
- gopls: hierarchical code action kinds, a resolve step for slow edits,
interactiveResolveProviderandcommand/resolve: https://go.dev/gopls/ - rust-analyzer: about 168 assists, grouped, resolved lazily so the lightbulb is fast: https://rust-analyzer.github.io/book/assists.html
- tsserver:
getCombinedCodeFixfixes every occurrence of one problem in a file: https://github.com/typescript-language-server/typescript-language-server - LSP
textDocument/codeAction,codeAction/resolve,CodeActionKind,disabled,isPreferred, and the 3.18 kindsrefactor.moveandnotebook: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/
Boundary
- specs/lsp/code_actions.t27
User Scenarios
- Given the cursor on a diagnostic that has a fix, when the client sends
textDocument/codeActionwithcontext.diagnosticsandonly: ["quickfix"], then the answer holds the quick fixes for that diagnostic only, with the best one markedisPreferred. - Given a request with
only: ["refactor"], when the module answers, then it returns kindsrefactor.extract,refactor.inline,refactor.rewriteandrefactor.movebut noquickfixand nosource.*. - Given an action whose edit is expensive, when it is listed, then it has no
edit, onlydata; when the client sendscodeAction/resolve, then the edit is computed and returned. - Given an action that cannot apply here, when the client supports
disabled, then the action is listed with adisabled.reason. - Given 6 diagnostics of the same code in one file, when the client asks for
source.fixAll, then one action fixes all 6 in a singleWorkspaceEdit.
Requirements
- FR-001: The module MUST define the kinds t27 uses as one table:
quickfix,refactor,refactor.extract,refactor.inline,refactor.rewrite,refactor.move,source,source.organizeImports,source.fixAllandsource.fixAll.t27, and MUST filter bycontext.onlywith prefix semantics. - FR-002: The module MUST register providers (a name, the kinds it can produce, a function from snapshot, range and diagnostics to actions) and MUST run only providers whose kinds match
only. - FR-003: Actions MUST be returned without
editwhen the provider marks them lazy, andcodeAction/resolveMUST fill ineditfromdatawithout re-running the other providers. - FR-004: The module MUST support
isPreferred,disabled,diagnosticslinkage,commandandtriggerKind(invoked or automatic). - FR-005: Every returned edit MUST apply cleanly: a test applies each edit from every provider to its fixture and re-analyses with 0 new errors.
- FR-006: The module MUST NOT contain a provider; adding one is a one-line registration in the module that owns the action.
Success Criteria
- At least 25 tests in
specs/lsp/code_actions.t27pass, run on the lab witht27c test-report(exit 0), using 3 stub providers registered in the test. - A negative control asks for
only: ["source.organizeImports"]and asserts that noquickfixprovider ran (counted by the stubs). git diff --name-only masterlists onlyspecs/lsp/code_actions.t27(0 files in other languages).
Metadata
Metadata
Assignees
Labels
area/specs.t27 spec files and conformance.t27 spec files and conformanceenhancementNew feature or requestNew feature or requestspec
Activity
gHashTag commentedon Nov 17, 2026
LSP spec created (typecheck OK, tests pass).