Skip to content

Commit 0daad4c

Browse files
razzmatazzKrzysztof-Cieslak
authored andcommitted
Add support for codeAction/resolve
1 parent 4bb126c commit 0daad4c

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

src/LanguageServerProtocol.fs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,19 @@ module Types =
776776
RetriggerCharacters: char[] option
777777
}
778778

779+
/// Code action options.
780+
type CodeActionOptions = {
781+
/// CodeActionKinds that this server may return.
782+
///
783+
/// The list of kinds may be generic, such as `CodeActionKind.Refactor`,
784+
/// or the server may list out every specific kind they provide.
785+
CodeActionKinds: string[] option;
786+
787+
/// The server provides support to resolve additional
788+
/// information for a code action.
789+
ResolveProvider: bool option;
790+
}
791+
779792
/// Code Lens options.
780793
type CodeLensOptions = {
781794
/// Code lens has a resolve provider as well.
@@ -895,7 +908,7 @@ module Types =
895908
WorkspaceSymbolProvider: bool option
896909

897910
/// The server provides code actions.
898-
CodeActionProvider: bool option
911+
CodeActionProvider: CodeActionOptions option
899912

900913
/// The server provides code lens.
901914
CodeLensProvider: CodeLensOptions option
@@ -1659,12 +1672,16 @@ module Types =
16591672
Diagnostics: Diagnostic[] option
16601673

16611674
/// The workspace edit this code action performs.
1662-
Edit: WorkspaceEdit
1675+
Edit: WorkspaceEdit option
16631676

16641677
/// A command this code action executes. If a code action
16651678
/// provides an edit and a command, first the edit is
16661679
/// executed and then the command.
16671680
Command: Command option
1681+
1682+
/// A data entry field that is preserved on a code action between
1683+
/// a `textDocument/codeAction` and a `codeAction/resolve` request.
1684+
Data: obj option
16681685
}
16691686

16701687
[<ErasedUnion>]
@@ -2407,6 +2424,14 @@ type LspServer() =
24072424
abstract member TextDocumentCodeAction: CodeActionParams -> AsyncLspResult<TextDocumentCodeActionResult option>
24082425
default __.TextDocumentCodeAction(_) = notImplemented
24092426

2427+
/// The code action request is sent from the client to the server to compute commands for a given text
2428+
/// document and range. These commands are typically code fixes to either fix problems or to
2429+
/// beautify/refactor code. The result of a textDocument/codeAction request is an array of Command literals
2430+
/// which are typically presented in the user interface. When the command is selected the server should be
2431+
/// contacted again (via the workspace/executeCommand) request to execute the command.
2432+
abstract member CodeActionResolve: CodeAction -> AsyncLspResult<CodeAction option>
2433+
default __.CodeActionResolve(_) = notImplemented
2434+
24102435
/// The code lens request is sent from the client to the server to compute code lenses for a given
24112436
/// text document.
24122437
abstract member TextDocumentCodeLens: CodeLensParams -> AsyncLspResult<CodeLens[] option>
@@ -2618,6 +2643,7 @@ module Server =
26182643
"textDocument/typeDefinition", requestHandling (fun s p -> s.TextDocumentTypeDefinition(p))
26192644
"textDocument/implementation", requestHandling (fun s p -> s.TextDocumentImplementation(p))
26202645
"textDocument/codeAction", requestHandling (fun s p -> s.TextDocumentCodeAction(p))
2646+
"codeAction/resolve", requestHandling (fun s p -> s.CodeActionResolve(p))
26212647
"textDocument/codeLens", requestHandling (fun s p -> s.TextDocumentCodeLens(p))
26222648
"codeLens/resolve", requestHandling (fun s p -> s.CodeLensResolve(p))
26232649
"textDocument/references", requestHandling (fun s p -> s.TextDocumentReferences(p))

0 commit comments

Comments
 (0)