A code action optionally supporting a lazy code action computation that is only run when the user clicks on the code action in the editor.
If you want to use the lazy feature, make sure that the edit?
field on the eager
code action result is none
.
- eager : Lean.Lsp.CodeAction
This is the initial code action that is sent to the server, to implement
- lazy? : Option (IO Lean.Lsp.CodeAction)
Instances For
Passed as the data?
field of Lsp.CodeAction
to recover the context of the code action.
- params : Lean.Lsp.CodeActionParams
- providerName : Lake.Name
Name of CodeActionProvider that produced this request.
- providerResultIndex : Nat
Index in the list of code action that the given provider generated.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Server.instFileSourceCodeAction = { fileSource := fun (x : Lean.Lsp.CodeAction) => Lean.Server.CodeAction.getFileSource! x }
Equations
- Lean.Server.instCoeCodeActionLazyCodeAction = { coe := fun (c : Lean.Lsp.CodeAction) => { eager := c, lazy? := none } }
A code action provider is a function for providing LSP code actions for an editor.
You can register them with the @[code_action_provider]
attribute.
This is a low-level interface for making LSP code actions. This interface can be used to implement the following applications:
- refactoring code: adding underscores to unused variables,
- suggesting imports
- document-level refactoring: removing unused imports, sorting imports, formatting.
- Helper suggestions for working with type holes (
_
) - Helper suggestions for tactics.
When implementing your own CodeActionProvider
, we assume that no long-running computations are allowed.
If you need to create a code-action with a long-running computation, you can use the lazy?
field on LazyCodeAction
to perform the computation after the user has clicked on the code action in their editor.
Equations
Instances For
Equations
- Lean.Server.addBuiltinCodeActionProvider decl provider = ST.Ref.modify Lean.Server.builtinCodeActionProviders fun (x : Lake.NameMap Lean.Server.CodeActionProvider) => x.insert decl provider
Instances For
Handles a textDocument/codeAction
request.
This is implemented by calling all of the registered CodeActionProvider
functions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Handler for "codeAction/resolve"
.
Equations
- One or more equations did not get rendered due to their size.