Skip to content

Support workspace/diagnostic requests for project-wide diagnostics #4741

@adinapoli

Description

@adinapoli

Is your enhancement request related to a problem? Please describe.

To rephrase a sentence I've heard many years ago in a documentary about Scotland "When HLS works, neovim is the most beautiful place in the world" (for reference, the original sentence was "When it's sunny, Scotland is the most beautiful place in the world").

I've had various degrees of success using HLS over the years, spanning from big to large projects, open source or otherwise, and my weapon of choice has always been vim / neovim. To the best of my knowledge (correct me if I'm wrong), editors like vim/neovim/emacs/helix they all work by having their LSP client send requests to acquire the diagnostics for the current buffer, which works but is not as ergonomic as having something like a quickfix window being populated with all the diagnostics for the whole project, so that we can stay within the editor without the usual ritual of "fix, run cabal build all, repeat".

Over the years a few plugins were developed to mitigate the issue; I know for example that emacs via lsp-mode loads all the files in a project inside the LSP "session" and for neovim plugins like workspace-diagnostics aim to do the same.

I think, but I'm not sure, that VSCode does something similar by indexing the files and loading them individually. Over the years I have tried a bit of everything, but as neovim feels like home to me and I was never able to switch, currently my workflow is a bit crippled given that the aforementioned plugin doesn't work particularly well, or rather it does but it's quite clunky and for large projects (where Template Haskell is heavily used) I'm getting bizzarre errors which I can't pinpoint if they come from HLS itself or from the way the neovim plugin loads them (and in which order, etc).

Describe the solution you'd like

Recently neovim added support for workspace diagnostics via the workspace/diagnostic request that a client can make to an LSP server in order to grab all the diagnostics for the workspace, not just the open buffer.

Unfortunately we can't leverage that in neovim as HLS doesn't implement this command, and this ticket is about enquiring how feasible would be to implement it, and if this is a good idea at all in the context of HLS/Haskell.

Thanks a lot!
Alfredo

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions