Turning off linter for lspconfig

I’m looking for a way to turn linter diagnostics off (messages like “variable foo is not initialized (fix available)” and so on). It is important if you already have a lining plugin like dense-analysis/ale or just need to disable linting for specific language.
I post the same question (error) here, but the proposed solution does nothing in my case. The default configuration for the clangd looks like that:

lua << EOF
require'lspconfig'.clangd.setup{}
EOF

How can I turn diagnostics off?

Pretty sure it’s because I made a typo :slight_smile: handlers was misspelled. The following should work:

local servers = {
  'clangd'
}
for _, lsp in ipairs(servers) do
  nvim_lsp[lsp].setup {
    handlers = {['textDocument/publishDiagnostics'] = function(...) end  }
}
end

yes, thank you, @mjlbach ! the full snippet will looks like that:

lua << EOF
local nvim_lsp = require('lspconfig')
local servers = {
    'clangd'
    }
for _, lsp in ipairs(servers) do
    nvim_lsp[lsp].setup {
        handlers = {['textDocument/publishDiagnostics'] = function(...) end  }
        }
end
EOF