Parse errors are on the correct line number now
This commit is contained in:
parent
5c4d0530f8
commit
cd4358a4b7
@ -155,7 +155,8 @@ later by fennel-ls.language to answer requests from the client."
|
|||||||
|
|
||||||
(λ on-parse-error [msg file line byte]
|
(λ on-parse-error [msg file line byte]
|
||||||
;; assume byte and char count is the same, ie no UTF-8
|
;; assume byte and char count is the same, ie no UTF-8
|
||||||
(let [range (message.pos->range line byte line byte)]
|
(let [line (- line 1)
|
||||||
|
range (message.pos->range line byte line byte)]
|
||||||
(table.insert diagnostics
|
(table.insert diagnostics
|
||||||
{:range range
|
{:range range
|
||||||
:message msg
|
:message msg
|
||||||
|
|||||||
@ -92,6 +92,9 @@ Every time the client sends a message, it gets handled by a function in the corr
|
|||||||
:value (formatter.hover-format result)}}
|
:value (formatter.hover-format result)}}
|
||||||
(catch _ nil))))
|
(catch _ nil))))
|
||||||
|
|
||||||
|
|
||||||
|
;; All of the helper functions for textDocument/completion are here until I
|
||||||
|
;; finish refactoring them, and then they can find a home in language.fnl
|
||||||
(λ collect-scope [scope typ callback ?target]
|
(λ collect-scope [scope typ callback ?target]
|
||||||
(let [result (or ?target [])]
|
(let [result (or ?target [])]
|
||||||
(var scope scope)
|
(var scope scope)
|
||||||
|
|||||||
@ -46,8 +46,8 @@
|
|||||||
(find [i v (ipairs diagnostics)]
|
(find [i v (ipairs diagnostics)]
|
||||||
(match v
|
(match v
|
||||||
{:message "expected whitespace before opening delimiter ("
|
{:message "expected whitespace before opening delimiter ("
|
||||||
:range {:start {:character 17 :line 1}
|
:range {:start {:character 17 :line 0}
|
||||||
:end {:character 17 :line 1}}}
|
:end {:character 17 :line 0}}}
|
||||||
v)))]
|
v)))]
|
||||||
(is diagnostic "expected a diagnostic")))
|
(is diagnostic "expected a diagnostic")))
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user