Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project-wide diagnostic messages in quickfix? #513

Open
hoclun-rigsep opened this issue May 18, 2024 · 4 comments
Open

Project-wide diagnostic messages in quickfix? #513

hoclun-rigsep opened this issue May 18, 2024 · 4 comments

Comments

@hoclun-rigsep
Copy link

Sorry if this is answered in the docs somewhere but there are a lot of features and using LSPs at all is new to me!

Is it possible to load the quickfix list with diagnostics for all source files in the project, not just the current buffer?

@Konfekt
Copy link
Contributor

Konfekt commented May 18, 2024

This should be possible by using :help :caddexpr.
For example, to merge the location lists of all open buffers into a quickfix list, adapt:

let s:all_locs = []
for bufnr in range(1, bufnr('$'))
    let s:locs = getloclist(bufnr)
    if !empty(s:locs)
        call map(s:locs, {idx, val -> extend(val, {'filename': bufname(bufnr)})})
        let s:all_locs += s:locs
    endif
endfor
call setqflist(s:all_locs)
copen

@hoclun-rigsep
Copy link
Author

I'm not expert in LSP but isn't this something the server (or some servers) provide?

@Konfekt
Copy link
Contributor

Konfekt commented May 18, 2024

Neither am I. The information per window or filename is the same, so it seems a matter of taste if one prefers to bundle them or not. But maybe you mean that it lints all files of a certain file type in a directory? I thought of LSP as a protocol to rather apply to opened files than crawling directories

@hoclun-rigsep
Copy link
Author

maybe you mean that it lints all files of a certain file type in a directory?

That's what I meant, all files the LSP understands to be source files within a project directory. But:

From dense-analysis/ale#4613 (comment)

  1. Note in documentation that Language Server Protocol currently does not offer a way to get a list of all problems for an entire project.

So it looks like your concept of the LSP is right, mine wrong. If I find time I'll play around with your approach above, thanks for the chat @Konfekt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants