FredFrugal
FredFrugal

Reputation: 75

neovim lsp-zero configure file throwing error from lsp.setup() function

I am trying to install the "lsp-zero" package and I am receiving the error posted below. I am desperate after trying to figure out what is going on. Any help would be great thank you.

I am not sure if it is related but I have had trouble using any sort of vim.cmd.<the-command-you-want> while writing my remaps like this: vim.keymap.set('n', '<leader>pv', vim.cmd.Ex) Last argument is what i am referring to.

I had to write them like this: vim.keymap.set('n', '<leader>pv', [[:Ex<CR>]], {noremap = true})

neovim was installed via apt-get repo version as well as npm

ERROR:

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 file located in my .config/nvim/after directory

local lsp = require('lsp-zero')

lsp.preset('recommended')
lsp.setup()                     -- CODE THROWING ERROR

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

I looked on stack overflow for something similar, asked chatgpt, looked on google, viewed _meta.lua file to look for errors.

I looked at file: nvim-cmp-setup.lua

here is the function

M.call_setup = function(opts)
  opts = opts or {}
  ... way more code but it is supposed to allow for no argument like in my lsp.lua file

my config file was copied directly from the github page. stumped....

Upvotes: 0

Views: 5653

Answers (1)

FredFrugal
FredFrugal

Reputation: 75

Solved by owner of repository (VonHeikemen) for lsp-zero. here is the link.

"My" solution to configure the lsp.lua config file is:

local lsp = require('lsp-zero')
lsp.preset('lsp-compe')

lsp.setup()

vim.opt.completeopt = {'menu', 'menuone', 'noselect'}

local cmp = require('cmp')
local cmp_config = lsp.defaults.cmp_config({})

cmp.setup(cmp_config)

Upvotes: 0

Related Questions