Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/artemave/workspace-diagnostics.nvim
Populate diagnostics for all projects files, not just the opened ones.
https://github.com/artemave/workspace-diagnostics.nvim
lsp neovim neovim-plugin
Last synced: 3 months ago
JSON representation
Populate diagnostics for all projects files, not just the opened ones.
- Host: GitHub
- URL: https://github.com/artemave/workspace-diagnostics.nvim
- Owner: artemave
- License: mit
- Created: 2024-02-07T13:51:33.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-02-10T16:15:43.000Z (3 months ago)
- Last Synced: 2024-02-10T17:28:49.565Z (3 months ago)
- Topics: lsp, neovim, neovim-plugin
- Language: Lua
- Homepage: https://artem.rocks/posts/workspace_diagnostics_nvim
- Size: 30.3 KB
- Stars: 23
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Lists
- awesome-neovim - artemave/workspace-diagnostics.nvim - Populate diagnostics for all projects files, not just the opened ones. (LSP / (requires Neovim 0.5))
- trackawesomelist - artemave/workspace-diagnostics.nvim (⭐29) - Populate diagnostics for all projects files, not just the opened ones. (Recently Updated / [Feb 12, 2024](/content/2024/02/12/README.md))
README
workspace-diagnostics.nvim
Populates project-wide lsp diagnostcs, regardless of what files are opened.This post goes into details of lsp diagnostics and how this plugin works.
Demo
Here you can see that even though a single file gets opened, the diagnostics are populated for other files as well.
https://github.com/artemave/workspace-diagnostics.nvim/assets/23721/ae32fdc8-a547-4194-ae00-df19c66d2b5f
## 📋 Installation
Package manager
Snippet[wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use {"workspace-diagnostics.nvim"}
```[junegunn/vim-plug](https://github.com/junegunn/vim-plug)
```lua
Plug "workspace-diagnostics.nvim"
```[folke/lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
require("lazy").setup({"workspace-diagnostics.nvim"})
```## ⚡️ Usage
Populate workspace diagnostcs when an lsp client is attached:
```lua
require('lspconfig').tsserver.setup({
on_attach = function(client, bufnr)
...
require("workspace-diagnostics").populate_workspace_diagnostics(client, bufnr)
...
end
})
```Despite its placement, `populate_workspace_diagnostics` will actually do the work only once per client.
## ⚙ Configuration
You can configure a different function that returns a list of project files (it defaults to the output of `git ls-files`).
```lua
require("workspace-diagnostics").setup({
workspace_files = function()
return { 'index.js', 'lib/banana.js' }
end
})
```## ⌨ Contributing
PRs and issues are always welcome. Make sure to provide as much context as possible when opening one.
To run `make lint` locally, you'd need to install [stylua](https://github.com/JohnnyMorganz/StyLua#installation):
```sh
cargo install stylua --features lua52
```