Skip to content

Fix: return empty list of Diagnostics[] when none exist

Brent Mackey requested to merge bjdm/qml-lsp:rjienrlwey into rjienrlwey

When handling publishDiagnostics, the server was appending to a null list, resulting in a null list being Marshaled when no diagnostics existed. Instead, an empty list is Marshaled and the client is able to clear the final remaining diagnostic when it is fixed. In neovim, this meant the server only functioned properly when diagnostics existed and crashed when they did not.

Reference: LSP Spec > When a file changes it is the server’s responsibility to re-compute diagnostics and push them to the client. If the computed set is empty it has to push the empty array to clear former diagnostics. Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens on the client side

Merge request reports