[fix] syntax
This commit is contained in:
parent
74f2c74fb4
commit
bf3dd4d693
2 changed files with 40 additions and 7 deletions
|
@ -55,10 +55,10 @@ return (
|
|||
)
|
||||
};
|
||||
|
||||
declare function docs:resolvePosition(text as xs:string, pos as docs:Position)
|
||||
declare function docs:resolvePosition($text as xs:string, $pos as docs:Position)
|
||||
as xs:integer
|
||||
{
|
||||
let line = 0, off = 0
|
||||
(: let line = 0, off = 0
|
||||
while (line < pos.line) {
|
||||
let next = text.indexOf("\n", off)
|
||||
if (!next) throw new RangeError("Position out of bounds")
|
||||
|
@ -67,15 +67,17 @@ as xs:integer
|
|||
}
|
||||
off += pos.character
|
||||
if (off > string-length($text)) throw new RangeError("Position out of bounds")
|
||||
return off
|
||||
}
|
||||
return off :)
|
||||
0
|
||||
};
|
||||
|
||||
declare function docs:toPosition($text as xs:string, $pos as xs:integer)
|
||||
as docs:Position {
|
||||
for (let off = 0, line = 0;;) {
|
||||
(: for (let off = 0, line = 0;;) {
|
||||
let next = text.indexOf("\n", off)
|
||||
if (next < 0 || next >= pos) return {line, character: pos - off}
|
||||
off = next + 1
|
||||
line++
|
||||
}
|
||||
}
|
||||
} :)
|
||||
docs:Position(0,0)
|
||||
};
|
31
webapp/lsp/lint.xqm
Normal file
31
webapp/lsp/lint.xqm
Normal file
|
@ -0,0 +1,31 @@
|
|||
module namespace lint="lsp/lint";
|
||||
(:
|
||||
Describes a problem or hint for a piece of code.
|
||||
|
||||
from: number
|
||||
|
||||
The start position of the relevant text.
|
||||
to: number
|
||||
|
||||
The end position. May be equal to from, though actually covering text is preferable.
|
||||
severity: "error" | "hint" | "info" | "warning"
|
||||
|
||||
The severity of the problem. This will influence how it is displayed.
|
||||
markClass?: string
|
||||
|
||||
When given, add an extra CSS class to parts of the code that this diagnostic applies to.
|
||||
source?: string
|
||||
|
||||
An optional source string indicating where the diagnostic is coming from. You can put the name of your linter here, if applicable.
|
||||
message: string
|
||||
|
||||
The message associated with this diagnostic.
|
||||
renderMessage?: fn(view: EditorView) → Node
|
||||
|
||||
An optional custom rendering function that displays the message as a DOM node.
|
||||
actions?: readonly Action[]
|
||||
|
||||
An optional array of actions that can be taken on this diagnostic.
|
||||
|
||||
|
||||
:)
|
Loading…
Add table
Reference in a new issue