pherrymason / c3-lsp

Language Server for C3 Language
https://pherrymason.github.io/c3-lsp/
GNU General Public License v3.0
78 stars 10 forks source link

Empty diagnostics send invalid URI #71

Closed tomaskallup closed 2 months ago

tomaskallup commented 2 months ago

Describe the bug When a file has diagnostic errors and they all get resolved, the server gives invalid URI (missing file:/ prefix).

To Reproduce

  1. Open any c3 source file
  2. Cause an error (for example remove ;)
  3. Save
  4. Fix the error
  5. Save
  6. Diagnostics with invald URI should be sent from the LSP

Expected behavior The URI should be correct and error should just disappear.

Screenshots image

Desktop (please complete the following information):

Additional context I tried fixing this myself, but this required moving the clearOldDiagnostics under the Server struct so I'm not sure if it's the right way to do this (I have pretty much zero experience in Go).

I have my fix in a commit https://github.com/tomaskallup/c3-lsp/commit/489f24eaea3c66cfc9db621387313dc7d779efde, tested it after rebuilding and everything seemed fine. The fix is tiny, so if it's correct, feel free to just commit it here, I could create a PR, but I would have to cherry-pick it into a fresh branch.

pherrymason commented 2 months ago

Thank you @tomaskallup !