workspace-diagnostics.nvim
workspace-diagnostics.nvim copied to clipboard
No errors for unopened files
Description
On my private ts-react project this plugin doesn't work. To be honest I have no ideat how to provide reproducable env but I would be happy to debug it somehow.
Here is my config related to lsp
local lspconfig = require("lspconfig")
local keymap = vim.keymap.set
local outerOpts = { noremap = true, silent = true }
keymap("n", "<leader>ls", "<cmd>LspStart <cr>", { desc = "Start lsp", unpack(opts) })
keymap("n", "<leader>lS", "<cmd>LspStop <cr>", { desc = "Stop lsp", unpack(opts) })
local on_attach = function(client, bufnr)
local opts = { buffer = bufnr }
keymap("n", "gD", vim.lsp.buf.declaration, opts)
keymap("n", "gd", vim.lsp.buf.definition, opts)
keymap("n", "K", vim.lsp.buf.hover, opts)
keymap("n", "<leader>lW", vim.diagnostic.setqflist)
keymap("n", "<C-k>", vim.lsp.buf.signature_help, opts)
keymap("n", "gr", vim.lsp.buf.references, opts)
keymap("n", "<leader>la", vim.lsp.buf.code_action, opts)
keymap("n", "<leader>lr", vim.lsp.buf.rename, opts)
require("workspace-diagnostics").trigger_workspace_diagnostics(client, bufnr)
end
-- LSP settings (for overriding per client)
local handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "single" }),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "single" }),
}
-- Enable the following language servers
local servers = {
"gopls",
"vuels",
"tsserver",
"pylsp",
"cssls",
"lua_ls",
"bashls",
"eslint",
"marksman",
"clangd",
"templ",
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup({
autostart = false,
on_attach = on_attach,
capabilities = capabilities,
handlers = handlers,
})
end
-- require("typescript-tools").setup({
-- autostart = false,
-- on_attach = on_attach,
-- capabilities = capabilities,
-- handlers = handlers,
-- root_dir = lspconfig.util.root_pattern("turbo.json", "tsconfig.json", "package.json", ".git"),
-- })
Steps to reproduce
- Open ts-react repo
- Attach lsp
- No error in Trouble until I open specific file with error.
Expected behavior
Errors should be visible for unopened files in trouble.nvim.
Environment
- Neovim version: 0.9.5
- workspace-diagnostics version: latest
- Plugin clash: Trouble