-
Notifications
You must be signed in to change notification settings - Fork 485
Expand file tree
/
Copy pathcode_actions.ml
More file actions
28 lines (26 loc) · 869 Bytes
/
Copy pathcode_actions.ml
File metadata and controls
28 lines (26 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(* This is the return that's expected when resolving code actions *)
let make ~title ~kind ~uri ~new_text ~range =
let text_document =
Lsp.Types.OptionalVersionedTextDocumentIdentifier.create
~uri:(Uri.from_string uri) ()
in
let edit =
Lsp.Types.WorkspaceEdit.create
~documentChanges:
[
`TextDocumentEdit
(Lsp.Types.TextDocumentEdit.create
~edits:
[
`TextEdit (Lsp.Types.TextEdit.create ~range ~newText:new_text);
]
~textDocument:text_document);
]
()
in
Lsp.Types.CodeAction.create ~title ~kind ~edit ()
let make_with_document_changes ~title ~kind ~document_changes =
let edit =
Lsp.Types.WorkspaceEdit.create ~documentChanges:document_changes ()
in
Lsp.Types.CodeAction.create ~title ~kind ~edit ()