nyoom-engineering / nyoom.nvim

A Neovim framework and doom emacs alternative for the stubborn martian hacker. Powered by fennel and the oxocarbon theme
MIT License
1.4k stars 82 forks source link

Cannot access configuration for clangd #101

Closed coder1044324 closed 1 year ago

coder1044324 commented 1 year ago

Before I open a .cpp file, the following error comes up. [lspconfig] Cannot access configuration for clangd. Ensure this server is listed inserver_configurations.mdor added as a custom server. I have ensured that the server is indeed listed in the file, and also that Mason.nvim has installed it. Any ideas for a fix?

Thanks

coder1044324 commented 1 year ago

Also how I could go about getting better syntax highlighting for cpp? If I'm not mistaken highlighting would be independent of this other problem right?

N0TiNSiGHT commented 1 year ago

If I'm not mistaken highlighting would be independent of this other problem right?

Yes, highlighting is controlled by treesitter and not lsp, but lsp gives you diagnostics.

For the 1st question, I'm not really sure if this helps but since I use Android, I think there are some libc differences that made some lsps not work correctly. I have clangd from Termux packages (couldn't install via mason) and it is in the path, but neovim doesn't detect it. I couldn't build from source either but I managed to find a workaround. I installed coc-clangd via coc-nvim and now the lsp works. You can disable coc-nvim via lazyload or whatever and the lsp will still be attached.

shaunsingh commented 1 year ago
image

It seems to be working on my end, are you sure you have the :lang cc module enabled? We use https://github.com/p00f/clangd_extensions.nvim to setup the clangd language server in order to get more language-specific features (inlay hints, ast/memory info, etc.).

First run ls ~/.local/share/nvim/mason/bin and check if clangd is in the list of executable binaries. If thats all good, then open up a c or c++ buffer and run :LspInfo, check if the clangd server is configured or not and if neovim can find it.

Also how I could go about getting better syntax highlighting for cpp? If I'm not mistaken highlighting would be independent of this other problem right?

We use nvim-treesitter for syntax highlighting. Enabling the cc module and telling nyoom sync to install all tree sitter parsers should install the c and c++ parsers. Try running TSPlayground in a c or c++ buffer and lmk if it works or not

coder1044324 commented 1 year ago

If I'm not mistaken highlighting would be independent of this other problem right?

Yes, highlighting is controlled by treesitter and not lsp, but lsp gives you diagnostics.

For the 1st question, I'm not really sure if this helps but since I use Android, I think there are some libc differences that made some lsps not work correctly. I have clangd from Termux packages (couldn't install via mason) and it is in the path, but neovim doesn't detect it. I couldn't build from source either but I managed to find a workaround. I installed coc-clangd via coc-nvim and now the lsp works. You can disable coc-nvim via lazyload or whatever and the lsp will still be attached.

Thanks, will try this if other stuff doesn't work!

image

It seems to be working on my end, are you sure you have the :lang cc module enabled? We use https://github.com/p00f/clangd_extensions.nvim to setup the clangd language server in order to get more language-specific features (inlay hints, ast/memory info, etc.).

First run ls ~/.local/share/nvim/mason/bin and check if clangd is in the list of executable binaries. If thats all good, then open up a c or c++ buffer and run :LspInfo, check if the clangd server is configured or not and if neovim can find it.

Also how I could go about getting better syntax highlighting for cpp? If I'm not mistaken highlighting would be independent of this other problem right?

We use nvim-treesitter for syntax highlighting. Enabling the cc module and telling nyoom sync to install all tree sitter parsers should install the c and c++ parsers. Try running TSPlayground in a c or c++ buffer and lmk if it works or not

Just double checked and the module is definitely enabled. clangd is in the list at ~/.local/share/nvim/mason/bin, however :LspInfo doesn't show clangd configured for some reason.

Language client log: /Users/___/.local/state/nvim/lsp.log
 Detected filetype:   cpp

 1 client(s) attached to this buffer: 

 Client: null-ls (id: 1, pid: nil, bufnr: [1])
    filetypes:       fnl, fennel, cpp, java, cs, c, cuda, clojure, luau, lua, markdown, nim, python, rust, sh, zig
    autostart:       false
    root directory:  Running in single file mode.
    cmd:             <function>

 Configured servers list: julials, bashls, jdtls, clojure_lsp, pyright, rnix, nimls, marksman, zls, sumneko_lua, texlab

TSPlayground does work..

diegofariasm commented 1 year ago

Also happens to me. It just happens in a clean install of the nyoom.

It seems like i can reproduce the issue doing the following:

I can also get another error doing the following:

  1. Delete ~/.local/share/nvim
  2. NyoomSync with cc disabled
  3. NyoomSync with cc enabled
  4. Open a file with either .c or .cpp

WIth this, when i first open nyoom, i get the follwing:

packer.nvim: Error running config for clangd_extensions.nvim: ...pt/clangd_extensions.nvim/lua/clangd_extensions/init.lua:9: module 'lspconfig' not found:
    no field package.preload['lspconfig']
    no file '/nix/store/5dz0pjv9plifhjk7n3x61jkh6l7jgcmw-luajit-2.1.0-2022-10-04-env/share/lua/5.1/lspconfig.lua'
    no file '/nix/store/5dz0pjv9plifhjk7n3x61jkh6l7jgcmw-luajit-2.1.0-2022-10-04-env/share/lua/5.1/lspconfig/init.lua'
    no file '/home/fushi/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lspconfig.lua'
    no file '/home/fushi/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/lspconfig/init.lua'
    no file '/home/fushi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/lspconfig.lua'
    no file '/home/fushi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/lspconfig/init.lua'
    no file '/nix/store/5dz0pjv9plifhjk7n3x61jkh6l7jgcmw-luajit-2.1.0-2022-10-04-env/lib/lua/5.1/lspconfig.so'
    no file '/home/fushi/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/lspconfig.so'

After that, the issue descbried in this post keeps happening everytime nyoom is opened.

diegofariasm commented 1 year ago

121 Should probably fix this. @coder1044324