pmizio / typescript-tools.nvim

⚡ TypeScript integration NeoVim deserves ⚡
MIT License
1.45k stars 40 forks source link

Bug: `settings.diagnostics.ignoreCode` is ignored #233

Closed chrisgrieser closed 7 months ago

chrisgrieser commented 7 months ago

When I have this in my config:

require("typescript-tools").setup {
    settings = {
        diagnostics = { 
             ignoredCodes = { 2451 } 
        },
    }
}

That diagnostic is still reported when using typescript-tools.nvim. Using the very same config for tsserver via nvim-lsp-config, settings.diagnostics.ignoreCode works fine.

pmizio commented 7 months ago

@chrisgrieser Everything you need to resolve this is in README. Long story short we use native neovim shenanigans to implement this feature. In your case it'll be:

local api = require("typescript-tools.api")
require("typescript-tools").setup {
  handlers = {
    ["textDocument/publishDiagnostics"] = api.filter_diagnostics { 2451 },
  },
}
chrisgrieser commented 7 months ago

Ah, thanks!

Well, at the very least, then this sentence from the readme is wrong:

The parameters passed into the setup function are also passed to the standard nvim-lspconfig server setup, allowing you to use the same settings here.

"The very same settings" cannot be used here. I didn't go further down the readme, since that part of the README led me to believe that settings.diagnostics.ignoreCode should be working