lsp_server
lsp_server copied to clipboard
Improved support for textDocument/publishDiagnostics
Contiunuing from #2 (LanguageClient)
The main functionality I was looking for was to show the compilation errors with textDocument/publishDiagnostics; is that supported?
If not, I have some code from someone that tried to implement the lsp server (in the new discourse forum) and it collects the compilation errors.
It isn't yet; I will try to do that next.
Great! Look forward to it!
Deployed v1.3.0 with preliminary support for publishDiagnostics.
I am not seeing any errors, most likely because didChange is not being handled (LanguageClient sends the whole document again on didChange).
UPDATE: I am seeing the error when I write the file to disk (as opposed to when I type), it is not showing singleton warnings. Why not use load_files/2 and capture the error messages (that way you have the full compiler support)?
UPDATE2: Regarding capturing messages from load_files, I meant using thread_message_hook/3
Hm, I was able to see errors with LanguageClient; it does the error stuff in didSave, so the changes shouldn’t be a problem. I’ll have a look tomorrow; I also have some improvements to the warnings for singleton variables in progress.
On Aug 11, 2019, at 16:27, erlanger [email protected] wrote:
I am not seeing any errors, most likely because didChange is not being handled (LanguageClient sends the whole document again on didChange).
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
it does the error stuff in didSave, so the changes shouldn’t be a problem.
Ahh, what I meant was that if you did the error checking on didChange, it would work real time! But you probably have to do a threaded implementation to do that.
Thanks!
BTW, look at the update above about using thread_message_hook/3 with load_files/2 that way you can just gather all the errors produced by the compiler.
Ah okay. I’d like to hook in to didChange at some point, but it isn’t working yet.
Regarding “load_file”, right now the process is working via the xref library, which just uses static analysis. It does make getting a lot of the diagnostics more challenging, but I’m doing it this way because I’m not confident in how robust it will be if it tries to actually load the source files to check them (e.g. if initialization goals run, top-level queries might have side effects, code that redefine predicates could interfere with the checker itself).
I’m not confident in how robust it will be if it tries to actually load the source files to check them
I see. I would ask Jan, I suspect there might be some way to get all the compiler errors in a safe way.
In any case, thanks for your great work!
I see. I would ask Jan, I suspect there might be some way to get all the compiler errors in a safe way.
Indeed. I’m about to go on vacation for two weeks; when I return, I’ll look into that. I’m also looking at the source for prolog_codewalk, to see if I can leverage that directly somehow.
In the meantime, I’ve released 1.3.2, which should have better display of singleton variable warnings.
Great! thanks!