purescript-language-server icon indicating copy to clipboard operation
purescript-language-server copied to clipboard

Suggestion: Extend diagnostics on type to buffer switches

Open i-am-the-slime opened this issue 3 years ago • 1 comments

I've been happily using the diagnostics on type feature. One inconsistency I find is when I fix all issues in one file and open/switch to another I still have to hit save or type something random to get up to date compiler results for that file.

My first instinct would be to hook into the textDocument_didOpen event.

i-am-the-slime avatar Sep 29 '22 09:09 i-am-the-slime

There was something around that already for opened buffers, or was in the past, see the "Build Opened Files" option - not sure if that's currently respected or not, but in theory it should do this already. At the time of starting writing this comment I was under the belief that we can't do arbitrary document focus actions, because there is no corresponding events for alraedy open documents.

However

After reading a comment on the LSP repo I realise that there was at some point added pull-based diagnostics; that didn't seem useful before because the "rebuild" based model didn't lend itself to it, but this could actually be the hook we need:

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentDiagnosticParams

(Depending when it's triggered, it might be better or supplementally useful for on-type diagnostics in general)

nwolverson avatar Sep 29 '22 09:09 nwolverson