How to disable LSP snippets

I manage my own snippets using Ultisnips, I don’t want conflicting snippets from the LSP server.

image

After Googling around it sounds like I should be able to disable snippets by doing:

lspconfig.yang_lsp.setup {
  on_attach = lsp_on_attach,
  capabilities = {
    textDocument = {
      completion = {
        completionItem = {
          snippetSupport = false
        }
      }
    }
  }
}

But that doesn’t work, compe is still suggesting LSP snippets.

I can’t just disable the LSP source in nvim-compe altogether, they are the primary reason I bother to use a completion plugin. Auto completion for types and identifiers from the LSP are invaluable.

I’m not sure how LSP capabilities work, is it just a “suggestion” for the LSP server that I don’t want snippets? Can the LSP server ignore it and suggest them anyway? If so, how do I get rid of them?

(I’m using nvim-compe)


I’m using nvim-lspconfig with yang-lsp:

-- Custom config for YANG language server
--
lspconfig_configs.yang_lsp = {
  default_config = {
    cmd = { "yang-language-server" },
    filetypes = { "yang" },
    root_dir = function(fname)
      return lsputil.root_pattern("yang.settings")(fname)
    end,
  },
  docs = {
    description = [[
TODO
    ]],
  },
}

Same issue, have you solved it?

I guess I did, because I’m no longer getting snippets from the LSP.

I don’t remember what I did though. This is the only special configuration I set:

lspconfig.yang_lsp.setup {
  on_attach = _G.lsp_on_attach,
  capabilities = {
    textDocument = {
      completion = {
        completionItem = {
          snippetSupport = false
        }
      }
    }
  }
}

Which, according to my original post, didn’t work. Perhaps it started working after an update or something.

Thank you for the reply. I want to disable the snippets from clangd, but the same configuration can’t work for me.