Comment by ~xerool on ~xerool/fennel-ls
I think when operating as a server, its better for unknown location errors to be on line one, instead of suppressed or crashing the server. However, when operating as --lint, we really should report "?" as the line number, like how fennel does.
Comment by ~xerool on ~xerool/fennel-ls
Fennel-ls is the one arbitrarily choosing the position (1, 1). https://git.sr.ht/~xerool/fennel-ls/tree/456acb4e150ee005d50d2e5df02d2fa44f765c07/item/src/fennel-ls/compiler.fnl#L303 when you compile with fennel, it reports the position as
unknown:?:?
Comment by ~xerool on ~technomancy/fennel
The expected sequence of events is:
- faccumulate expands.
(do (var foo {}) (for [50 60 100] (set foo (print foo))) foo)
- as part of macroexpand, walk the tree with
propagate-trace-info
. Specifically, we should set the source info of the [50 60 100] table.- when the body is compiled, specials.fnl:727 should see that 50 is not a sym. it runs
compiler.assert
, reporting that the table [50 60 100] is the cause.- since the information was propagated, the compiler reports that the entire faccumulate macro call is the location of the error.
Ticket created by ~xerool on ~technomancy/fennel
from ~xerool/fennel-ls#52:
(faccumulate [foo {} 50 60 100] (print foo))outputs the following
unknown:?:?: Compile error: unable to bind number 50
I expected a filename and line and column, but got
unknown:?:?:
Comment by ~xerool on ~xerool/fennel-ls
REPORTED
RESOLVED CLOSEDbug added by ~xerool on ~xerool/fennel-ls
enchancement added by ~xerool on ~xerool/fennel-ls
Comment by ~xerool on ~xerool/fennel-ls
We would be able to support this by implementing #49.
Ticket created by ~xerool on ~xerool/fennel-ls
You can see the following code in many functions in handlers.fnl
(lint.add-lint-diagnostics server file) (send (message.diagnostics file))This code eagerly computes and pushes diagnostics to the client. However, (lint.add-lint-diagnostics) is expensive and ideally we could reduce the number of times we compute lints.
We should do this by supporting pull diagnostics if possible: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics Clients will have better debounce logic and won't request diagnostics repeatedly in between each edit unless a user pauses.
One concern is that I'm not sure if Neovim supports these pull diagnostics.