doom-neovim / doom-nvim

A Neovim configuration for the advanced martian hacker
GNU General Public License v2.0
1k stars 108 forks source link

[BUG] cc LSP not working on Linux by default #407

Closed edwintorok closed 1 year ago

edwintorok commented 1 year ago

Current Behavior:

[doom] [ERROR 14:33:12] utils.lua:324: Error setting up language `cc`. 
/home/edwin/.config/nvim/lua/doom/modules/langs/utils.lua:102: Error installing mason package `nil`.  Reason: 
No package_name provided. 
stack traceback:
        [C]: in function 'error'
        /home/edwin/.config/nvim/lua/doom/modules/langs/utils.lua:102: in function 'on_err'
        /home/edwin/.config/nvim/lua/doom/modules/langs/utils.lua:113: in function 'use_mason_package'
        /home/edwin/.config/nvim/lua/doom/modules/langs/utils.lua:246: in function 'use_lsp_mason'
        /home/edwin/.config/nvim/lua/doom/modules/langs/cc/init.lua:61: in function </home/edwin/.config/nvim/lua/doom/modules
/langs/cc/init.lua:59>
        [C]: in function 'xpcall'
        /home/edwin/.config/nvim/lua/doom/modules/langs/utils.lua:322: in function ''
        vim/_editor.lua: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Expected Behavior:

LSP working when opening .c files

Steps To Reproduce:

  1. nvim x.c

Logs

Check Health Output ``` mason: require("mason.health").check() ======================================================================== ## mason.nvim report - OK: neovim version >= 0.7.0 - OK: **Go**: `go version go1.19.2 linux/amd64` - OK: **cargo**: `cargo 1.64.0` - OK: **luarocks**: `/usr/bin/luarocks 3.7.0` - OK: **Ruby**: `ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]` - OK: **RubyGem**: `3.3.7` - WARNING: **Composer**: not available - WARNING: **PHP**: not available - OK: **npm**: `8.19.2` - OK: **node**: `v18.10.0` - OK: **python3**: `Python 3.11.0rc2` - OK: **pip3**: `pip 22.2.2 from /usr/lib/python3.11/site-packages/pip (python 3.11)` - OK: **javac**: `javac 17.0.4.1` - OK: **java**: `openjdk version "17.0.4.1" 2022-08-12` - OK: **julia**: `julia version 1.8.0` - OK: **wget**: `GNU Wget 1.21.3 built on linux-gnu.` - OK: **curl**: `curl 7.85.0 (x86_64-redhat-linux-gnu) libcurl/7.85.0 OpenSSL/3.0.5 zlib/1.2.12 brotli/1.0.9 libidn2/2.3.3 libpsl/0.21.1 (+libidn2/2.3.3) libssh/0.10.4/openssl/zlib nghttp2/1.49.0` - OK: **gzip**: `gzip 1.12` - OK: **tar**: `tar (GNU tar) 1.34` - OK: **bash**: `GNU bash, version 5.2.2(1)-release (x86_64-redhat-linux-gnu)` - OK: **sh**: `Ok` - OK: **python3_host_prog**: `Python 3.11.0rc2` - OK: GitHub API rate limit. Used: 3. Remaining: 57. Limit: 60. Reset: Sat 15 Oct 2022 15:26:56 BST. mkdp: health#mkdp#check ======================================================================== - INFO: Platform: linux - INFO: Nvim Version: NVIM v0.8.0 - INFO: Pre build: /home/edwin/.local/share/nvim/site/pack/packer/start/markdown-preview.nvim/app/bin/markdown-preview-linux - INFO: Pre build version: 0.0.10 - OK: Using pre build nvim: health#nvim#check ======================================================================== ## Configuration - OK: no issues found ## Performance - OK: Build type: RelWithDebInfo ## Remote Plugins - OK: Up to date ## terminal - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177 - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~ - INFO: $VTE_VERSION='7000' - INFO: $COLORTERM='truecolor' nvim-treesitter: require("nvim-treesitter.health").check() ======================================================================== ## Installation - OK: `tree-sitter` found 0.20.7 (parser generator, only needed for :TSInstallFromGrammar) - OK: `node` found v18.10.0 (only needed for :TSInstallFromGrammar) - OK: `git` executable found. - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: cc (GCC) 12.2.1 20220819 (Red Hat 12.2.1-2) - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI. ## Parser/Features H L F I J - cpp ✓ ✓ ✓ ✓ ✓ - norg . . . . . - ocaml_interface✓ ✓ ✓ . ✓ - ocamllex ✓ . . . ✓ - c ✓ ✓ ✓ ✓ ✓ - python ✓ ✓ ✓ ✓ ✓ - lua ✓ ✓ ✓ ✓ ✓ - ocaml ✓ ✓ ✓ . ✓ - markdown ✓ . ✓ . ✓ Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections +) multiple parsers found, only one will be used x) errors found in the query, try to run :TSUpdate {lang} provider: health#provider#check ======================================================================== ## Clipboard (optional) - OK: Clipboard tool found: xclip ## Python 3 provider (optional) - INFO: Disabled (g:loaded_python3_provider=0). ## Python virtualenv - OK: no $VIRTUAL_ENV ## Ruby provider (optional) - INFO: Disabled (g:loaded_ruby_provider=0). ## Node.js provider (optional) - INFO: Disabled (g:loaded_node_provider=0). ## Perl provider (optional) - INFO: Disabled (g:loaded_perl_provider=0). telescope: require("telescope.health").check() ======================================================================== ## Checking for required plugins - OK: plenary installed. - OK: nvim-treesitter installed. ## Checking external dependencies - OK: rg: found ripgrep 13.0.0 - OK: fd: found fd 8.2.1 ## ===== Installed extensions ===== ## Telescope Extension: `file_browser` - INFO: No healthcheck provided ## Telescope Extension: `fzf` - INFO: No healthcheck provided ## Telescope Extension: `mapper` - INFO: No healthcheck provided ## Telescope Extension: `projects` - INFO: No healthcheck provided vim.lsp: require("vim.lsp.health").check() ======================================================================== - INFO: LSP log level : WARN - INFO: Log path: /home/edwin/.local/state/nvim/lsp.log - INFO: Log size: 175 KB vim.treesitter: require("vim.treesitter.health").check() ======================================================================== - INFO: Runtime ABI version : 14 - OK: Loaded parser for c: ABI version 13 - OK: Loaded parser for cpp: ABI version 14 - OK: Loaded parser for lua: ABI version 13 - OK: Loaded parser for markdown: ABI version 13 - OK: Loaded parser for norg: ABI version 14 - OK: Loaded parser for norg_meta: ABI version 13 - OK: Loaded parser for norg_table: ABI version 13 - OK: Loaded parser for ocaml: ABI version 13 - OK: Loaded parser for ocaml_interface: ABI version 13 - OK: Loaded parser for ocamllex: ABI version 14 - OK: Loaded parser for python: ABI version 13 which_key: health#which_key#check ======================================================================== ## WhichKey: checking conflicting keymaps - WARNING: conflicting keymap exists for mode **"n"**, lhs: **" ca"** - INFO: rhs: ` ` - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"gc"** - INFO: rhs: `lua require("Comment.api").call('toggle.linewise', '@g')` ```
Doom Report Output ``` E5107: Error loading lua [string ":lua"]:1: unexpected symbol near '' ```

Anything else:

Workaround: use clangd (it is the one I wanted to use anyway):

diff --git a/lua/doom/modules/langs/cc/init.lua b/lua/doom/modules/langs/cc/init.lua
index 0fa998a..ea63611 100644
--- a/lua/doom/modules/langs/cc/init.lua
+++ b/lua/doom/modules/langs/cc/init.lua
@@ -15,7 +15,7 @@ cc.settings = {
   disable_lsp = false,
   --- name of the language server
   --- @type string
-  lsp_name = utils.get_sysname() == "Darwin" and "clangd" or "ccls",
+  lsp_name = "clangd",
   --- Custom config to pass to nvim-lspconfig
   --- @type table|nil
   lsp_config = {

The available packages are here https://github.com/williamboman/mason.nvim/blob/main/PACKAGES.md and there is no ccls there.

connorgmeehan commented 1 year ago

Ahh thanks for the PR. Looks like mason only has clangd, will update now.

connorgmeehan commented 1 year ago

Fixed in 1b8eb58a4f811b228b854fb24594a47be086d8fb.