123456789101112131415161718192021222324252627282930313233343536373839404142(*
* 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
*
*)openstructmoduleL=Lsp.TypesendmoduleLoc=structletlsp_pos_of_pos(pos:Asai.Range.position)=L.Position.create~line:(pos.line_num-1)~character:(pos.offset-pos.start_of_line)letlsp_range_of_range(r:Asai.Range.toption)=matchrwith|Somer->let(start,stop)=matchAsai.Range.viewrwith|`Range(start,stop)->start,stop|`End_of_filepos->pos,posinL.Range.create~start:(lsp_pos_of_posstart)~end_:(lsp_pos_of_posstop)|None->(* When we have a message without a location,
we set it's location to the start of the file,
as we don't have any better choices. *)letstart_of_file=L.Position.create~line:0~character:0inL.Range.create~start:start_of_file~end_:start_of_fileendmoduleDiagnostic=structletlsp_severity_of_severity:Asai.Diagnostic.severity->L.DiagnosticSeverity.t=function|Hint->Hint|Info->Information|Warning->Warning|Error->Error|Bug->Errorend