97 lines
2.5 KiB
Text
97 lines
2.5 KiB
Text
(:~ LSPserver type definitions
|
|
@see https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
|
|
@author Andy Bunce
|
|
:)
|
|
module namespace lspt = 'lsp-typedefs';
|
|
|
|
(:~ json numbers :)
|
|
declare type lspt:num as (xs:integer|xs:double);
|
|
|
|
(:~
|
|
@param line Line position in a document (zero-based).
|
|
@param character Character offset on a line in a document (zero-based).
|
|
:)
|
|
declare record lspt:Position(
|
|
line as lspt:num,
|
|
character as lspt:num
|
|
);
|
|
|
|
(:~
|
|
@param line Line position in a document (zero-based).
|
|
@param character Character offset on a line in a document (zero-based).
|
|
:)
|
|
declare record lspt:Range(
|
|
start as lspt:Position,
|
|
end as lspt:Position
|
|
);
|
|
|
|
declare type lspt:SymbolKind as xs:integer;
|
|
declare type lspt:SymbolTag as xs:string;
|
|
|
|
declare record lspt:symbol (
|
|
name as xs:string,
|
|
type as xs:string,
|
|
range-name? as lspt:Range,
|
|
range-full? as lspt:Range,
|
|
children? as array(lspt:symbol)
|
|
);
|
|
|
|
declare record lspt:DocumentSymbol(
|
|
|
|
(: The name of this symbol. Will be displayed in the user interface and
|
|
therefore must not be an empty string or a string only consisting of white spaces. :)
|
|
name as xs:string,
|
|
|
|
(: The kind of this symbol. :)
|
|
kind as lspt:SymbolKind,
|
|
|
|
(: The range enclosing this symbol not including leading/trailing whitespace
|
|
but everything else like comments. This information is typically used to
|
|
determine if the clients cursor is inside the symbol to reveal it in the UI. :)
|
|
range as lspt:Range,
|
|
|
|
(:The range that should be selected and revealed when this symbol is being
|
|
picked, e.g. the name of a function. Must be contained by the `range`. :)
|
|
selectionRange as lspt:Range,
|
|
|
|
(: More detail for this symbol, e.g the signature of a function.:)
|
|
detail? as xs:string,
|
|
|
|
(: Tags for this document symbol. @since 3.16.0 :)
|
|
tags? as lspt:SymbolTag*,
|
|
|
|
(: Children of this symbol, e.g. properties of a class. :)
|
|
children? as lspt:DocumentSymbol*
|
|
);
|
|
|
|
|
|
declare variable $lspt:SymbolKindMap :={
|
|
'File': 1 ,
|
|
'Module': 2 ,
|
|
'Namespace': 3 ,
|
|
'Package': 4 ,
|
|
'Class': 5 ,
|
|
'Method': 6 ,
|
|
'Property': 7 ,
|
|
'Field': 8 ,
|
|
'Constructor': 9 ,
|
|
'Enum': 10 ,
|
|
'Interface': 11 ,
|
|
'Function': 12 ,
|
|
'Variable': 13 ,
|
|
'Constant': 14 ,
|
|
'String': 15 ,
|
|
'Number': 16 ,
|
|
'Boolean': 17 ,
|
|
'Array': 18 ,
|
|
'Object': 19 ,
|
|
'Key': 20 ,
|
|
'Null': 21 ,
|
|
'EnumMember': 22 ,
|
|
'Struct': 23 ,
|
|
'Event': 24 ,
|
|
'Operator': 25 ,
|
|
'TypeParameter': 26
|
|
};
|
|
|
|
declare type lspt:TraceValue as enum( 'off' , 'messages' , 'verbose');
|