mattn / efm-langserver

General purpose Language Server
MIT License
1.34k stars 61 forks source link

publishDiagnostics is no longer sent when there are no diagnostics #197

Closed fsouza closed 2 years ago

fsouza commented 2 years ago

Looks like this is a regression caused by #193. Example workflow with Python and flake8 (could be anything really):

  1. I make a change in the editor. flake8 won't be happy with this change
  2. Editor sends textDocument/didChange to efm
  3. efm runs flake8, gets the error, build the list of diagnostics and invoke textDocument/publishDiagnostics
  4. Editor renders the errors, I fix the error and the editor sends textDocument/didChange to efm
  5. efm runs flake8, gets no errors and don't send textDocument/publishDiagnostics
  6. Editor continues to display the error message

On step 5, efm should send textDocument/publishDiagnostics with an empty list of diagnostics, but instead it simply doesn't send the notification.

fsouza commented 2 years ago

Sent #198. Let me know what you think.

ayamir commented 2 years ago

Seems like not fully fix it?

https://user-images.githubusercontent.com/61657399/148958118-15e1c7e3-57ab-49a5-8b3b-ca20e0982406.mp4

return {
    lintCommand = "flake8 --max-line-length 160 --format '%(path)s:%(row)d:%(col)d: %(code)s %(code)s %(text)s' --stdin-display-name ${INPUT} -",
    lintStdin = true,
    lintIgnoreExitCode = true,
    lintFormats = {"%f:%l:%c: %t%n%n%n %m"},
    lintSource = "flake8"
}