Neovim中lsp-zero插件lsp.setup()函数执行报错求助
关于lsp-zero.nvim初始化报错及按键映射问题的求助
我在安装lsp-zero插件时,调用lsp.setup()函数出现报错,多方排查无果,寻求解决。另外配置按键映射时,vim.keymap.set('n', '<leader>pv', vim.cmd.Ex)无法正常工作,只能改用vim.keymap.set('n', '<leader>pv', [[:Ex<CR>]], {noremap = true}),不确定是否和报错有关。我的Neovim通过apt-get仓库和npm安装。
报错信息
E5108: Error executing lua vim/_meta.lua:597: E474: Invalid argument stack traceback: [C]: in function 'nvim_set_option_value' vim/_meta.lua:597: in function 'append' ...cker/start/lsp-zero.nvim/lua/lsp-zero/nvim-cmp-setup.lua:152: in function 'call_setup' ...im/site/pack/packer/start/lsp-zero.nvim/lua/lsp-zero.lua:32: in function 'setup' [string ":source (no file)"]:5: in main chunk
lsp.lua配置文件(位于~/.config/nvim/after目录)
local lsp = require('lsp-zero') lsp.preset('recommended') lsp.setup() -- 触发报错的代码行
packer.lua配置
use { 'VonHeikemen/lsp-zero.nvim', requires = { -- LSP Support {'neovim/nvim-lspconfig'}, {'williamboman/mason.nvim'}, {'williamboman/mason-lspconfig.nvim'}, -- Autocompletion {'hrsh7th/nvim-cmp'}, {'hrsh7th/cmp-buffer'}, {'hrsh7th/cmp-path'}, {'saadparwaiz1/cmp_luasnip'}, {'hrsh7th/cmp-nvim-lsp'}, {'hrsh7th/cmp-nvim-lua'}, -- Snippets {'L3MON4D3/LuaSnip'}, {'rafamadriz/friendly-snippets'}, } }
Neovim :checkhealth结果
mason: require("mason.health").check() ======================================================================== ## mason.nvim report - OK: neovim version >= 0.7.0 - WARNING: **Go**: not available - OK: **cargo**: `cargo 1.65.0 (4bc8f24d3 2022-10-20)` - WARNING: **luarocks**: not available - WARNING: **Ruby**: not available - WARNING: **RubyGem**: not available - WARNING: **Composer**: not available - WARNING: **PHP**: not available - OK: **npm**: `9.2.0` - OK: **node**: `v18.12.1` - OK: **python3**: `Python 3.10.6` - OK: **pip3**: `pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)` - WARNING: **javac**: not available - WARNING: **java**: not available - WARNING: **julia**: not available - OK: **wget**: `GNU Wget 1.21.2 built on linux-gnu.` - OK: **curl**: `curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.13` - OK: **gzip**: `gzip 1.10` - OK: **tar**: `tar (GNU tar) 1.34` - OK: **bash**: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)` - OK: **sh**: `Ok` - OK: GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Mon 19 Dec 2022 06:59:38 PM PST. nvim: health#nvim#check ======================================================================== ## Configuration - OK: no issues found ## Performance - OK: Build type: Release ## 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='6800' - INFO: $COLORTERM='truecolor' nvim-treesitter: require("nvim-treesitter.health").check() ======================================================================== ## Installation - WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall) - OK: `node` found v18.12.1 (only needed for :TSInstallFromGrammar) - OK: `git` executable found. - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" } Version: cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI. ## OS Info: { machine = "x86_64", release = "6.0.6-76060006-generic", sysname = "Linux", version = "#202210290932~1669062050~22.04~d94609a SMP PREEMPT_DYNAMIC Mon N" } ## Parser/Features H L F I J - diff ✓ . . . . - lua ✓ ✓ ✓ ✓ ✓ - help ✓ . . . ✓ - rust ✓ ✓ ✓ ✓ ✓ - vim ✓ ✓ ✓ . ✓ - javascript ✓ ✓ ✓ ✓ ✓ - json ✓ ✓ ✓ ✓ . - c ✓ ✓ ✓ ✓ ✓ 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: `g:python3_host_prog` is not set. Searching for python3 in the environment. - INFO: Multiple python3 executables found. Set `g:python3_host_prog` to avoid surprises. - INFO: Executable: /usr/bin/python3 - INFO: Other python executable: /bin/python3 - INFO: Python version: 3.10.6 - INFO: pynvim version: 0.4.2 (outdated; from /usr/lib/python3/dist-packages/neovim) - WARNING: Latest pynvim is NOT installed: 0.4.3 ## Python virtualenv - OK: no $VIRTUAL_ENV ## Ruby provider (optional) - WARNING: `ruby` and `gem` must be in $PATH. - ADVICE: - Install Ruby and verify that `ruby` and `gem` commands work. ## Node.js provider (optional) - INFO: Node.js: v18.12.1 - WARNING: Missing "neovim" npm (or yarn) package. - ADVICE: - Run in shell: npm install -g neovim - Run in shell (if you use yarn): yarn global add neovim - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim ## Perl provider (optional) - WARNING: "Neovim::Ext" cpan module is not installed - ADVICE: - See :help |provider-perl| for more information. - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim 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.3.1 ## ===== Installed extensions ===== vim.lsp: require("vim.lsp.health").check() ======================================================================== - INFO: LSP log level : WARN - INFO: Log path: /home/pnuema1.618/.cache/nvim/lsp.log - INFO: Log size: 41 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 diff: ABI version 14 - OK: Loaded parser for help: ABI version 14 - OK: Loaded parser for javascript: ABI version 14 - OK: Loaded parser for json: ABI version 13 - OK: Loaded parser for lua: ABI version 13 - OK: Loaded parser for rust: ABI version 14 - OK: Loaded parser for vim: ABI version 14
我已经在Stack Overflow、Google搜索相关问题,咨询ChatGPT,查看_meta.lua和nvim-cmp-setup.lua文件,但仍未找到解决办法,配置文件是直接从官方GitHub仓库复制的示例。
内容的提问来源于stack exchange,提问作者FredFrugal
相关产品推荐
相关产品推荐

