VonHeikemen / lsp-zero.nvim

A starting point to setup some lsp related features in neovim.
https://lsp-zero.netlify.app/v3.x/
MIT License
3.68k stars 94 forks source link

CCLS #308

Open TheFloatingBrain opened 10 months ago

TheFloatingBrain commented 10 months ago

CCLS is a C/C++/Objective-C language server that can be used with lsp-config (which I understand that lsp-zero is built using). If I run LspInstall it only gives me clangd (when though there are other C++ language servers/related things (formatters/linters) available on Mason (clang-format, codelldb, cpplint, cpptools soralint-language-server) tagged as being C++ servers, but they dont show up in the list. If I try to use lsp.setup_servers({'ccls', force = true}) nothing seems to happen. I wanted to know: since lsp-zero builds on lsp-config, is there a work-around to get it to support CCLS? In addition, could CCLS be added?

VonHeikemen commented 10 months ago

If is not avaible in mason.nvim then you will have to install it manually. Then just use lspconfig like they show on the wiki.

TheFloatingBrain commented 10 months ago

I tried a slight variation on the default config:

local lspconfig = require('lspconfig')
lspconfig.ccls.setup {
  init_options = {
    compilationDatabaseDirectory = "build";
    cache = {
      directory = ".ccls-cache";
    };
  }
}

Seems to work, but no auto complete, it is saying that it cant find the nvim-cmp module.

VonHeikemen commented 10 months ago

Does autocomplete work with any other language server?

TheFloatingBrain commented 10 months ago

Yes, I got it to work with python-language-server with the config I was trying commented out. If I uncomment it however, it does tell me it cant find cmp or nvim-cmp if I try to use the code at the top of this. Not sure if I need it though, if I delete that code from init.lua autocomplete for python works fine. However I am not sure if I need this more advanced completion for CCLS

VonHeikemen commented 10 months ago

So it seems you don't have nvim-cmp installed, or is not loading correctly. So whatever completions you do have working they are not configured by lsp-zero.

If you don't need nvim-cmp, you can delete the code that uses the cmp module from your config.

If you want lsp-zero to handle the autocomplete configuration, make sure you have all these plugins installed: