package forester
A tool for tending mathematical forests
Install
dune-project
Dependency
Authors
Maintainers
Sources
5.0.tar.gz
md5=24f4aed96a8b8af33aba13fba66f1b37
sha512=d36b896aca11858bb4a00fc704c16cc27a1f197bdb3e479d6132fd70f70d67d7158096285cb0b6fb00db14417f0f822cc27fe65d82f0971e42378fd8271ce573
doc/src/forester.language_server/Code_action.ml.html
Source file Code_action.ml
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
(* * SPDX-FileCopyrightText: 2024 The Forester Project Contributors AND The RedPRL Development Team * * SPDX-License-Identifier: GPL-3.0-or-later OR Apache-2.0 WITH LLVM-exception * *) open Forester_compiler open struct module L = Lsp.Types end let resolve (params : L.CodeAction.t) = params let next_addrs ~(forest : State.t) prefix = URI_util.next_uri ~prefix ~mode: `Sequential ~forest, URI_util.next_uri ~prefix ~mode: `Random ~forest let create_tree_edit ~range ~uri addr dir = L.WorkspaceEdit.create ~documentChanges: [ `CreateFile ( L.CreateFile.create ~uri: (Lsp.Uri.of_path (Format.asprintf "%s/%s.tree" dir addr)) () ); `TextDocumentEdit ( L.TextDocumentEdit.create ~textDocument: {uri; version = None} ~edits: [`TextEdit {newText = Format.asprintf "\\transclude{%s}" addr; range}] ) ] () let compute (L.CodeActionParams.{range; textDocument = {uri}; _;}) : L.CodeActionResult.t = let Lsp_state.{forest; _} = Lsp_state.get () in let actions = let next_sequential, next_random = next_addrs ~forest None in match forest.config.trees with | [] -> [] | dir :: _ -> let sequential = L.CodeAction.create ~title: (Format.asprintf "create new tree (sequential address)") ~kind: (L.CodeActionKind.Other "new tree") ~edit: (create_tree_edit ~range ~uri next_sequential dir) () in let random = L.CodeAction.create ~title: (Format.asprintf "create new tree (random address)") ~kind: (L.CodeActionKind.Other "new tree") ~edit: (create_tree_edit ~range ~uri next_random dir) () in [`CodeAction sequential; `CodeAction random] in Some actions
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>