Something went wrong. Try again.
ocaml
Something went wrong. Try again.
972 B · 33 lines
OCaml
at pp-ast
12345678910111213141516171819202122232425262728293031323334(* * SPDX-FileCopyrightText: 2024 The Forester Project Contributors * SPDX-FileCopyrightText: 2026 The Forester Project Contributors * * SPDX-License-Identifier: GPL-3.0-or-later *)
open Forester_coreopen Forester_compileropen Forester_frontend
open struct module L = Lsp.Typesend
let start_of_file = let beginning = L.Position.create ~character:0 ~line:0 in L.Range.create ~start:beginning ~end_:beginning
let state_and_uri lsp_uri = let Lsp_state.{forest; _} = Lsp_state.get () in (forest, URI.of_lsp_uri ~base:(Forest.base forest) lsp_uri)
let code_nodes ~(forest : Forest.t) (uri : URI.t) : Code.t option = Option.map Tree.Parsed.nodes (Forest.get_code ~forest uri)
let code_nodes_for_doc lsp_uri = let forest, uri = state_and_uri lsp_uri in Option.map (fun nodes -> (forest, uri, nodes)) (code_nodes ~forest uri)
let is_foreign_docs_uri ~forest uri = URI.same_site ~base:Config.docs_url uri && Router.Scope.get ~forest uri <> Local