Code Monkey home page Code Monkey logo

Comments (25)

Leo-Zarni01 avatar Leo-Zarni01 commented on September 4, 2024 6

May I ask how this issue was resolved? I'm currently experiencing a similar issue that's why. I am also using the latest node version as well.

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024 2

Did you setup the below setting?

-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)

-- The following example advertise capabilities to `clangd`.
require'lspconfig'.clangd.setup {
  capabilities = capabilities,
}```

from cmp-nvim-lsp.

dmitmel avatar dmitmel commented on September 4, 2024 2

@JensPauwels @nikbrunner I am guessing here, but it looks like you have an old version of Nodejs installed, which doesn't support the object?.key syntax.

from cmp-nvim-lsp.

JensPauwels avatar JensPauwels commented on September 4, 2024 1

I'm experiencing the same as described by @nikbrunner

from cmp-nvim-lsp.

nikbrunner avatar nikbrunner commented on September 4, 2024 1

@JensPauwels @nikbrunner I am guessing here, but it looks like you have an old version of Nodejs installed, which doesn't support the object?.key syntax.

  • For work I have to use node 12.13.0 and I now switched for testing to just the latest version with nvm use node which got me to 17.2.0
  • When I entered a project with nvim and navigated to a .css file, I got this error
    • Spawning language server with cmd: "vscode-css-language-server" failed. The language server is either not installed, missing from PATH, or not executable
  • I tried to re-install the cssls language server with lsp-installer, but to no success
  • I ran manually npm i -g vscode-langservers-extracted and re-entered the file
  • Now it worked (See Screenshot)
  • When I switch back to node 12.13.0 and I re-enter, I get the error Client 1 quit with exit code 1 and signal 0, which is also reflected in the log file

:CmpStatus with node 17.2.0 and manually installed language server

image

~/.cache/nvim/lsp.log when entering file with node 12.13.0

[START][2021-12-27 14:24:56] LSP logging initiated
[START][2021-12-27 14:29:34] LSP logging initiated
[ERROR][2021-12-27 14:29:40] .../vim/lsp/rpc.lua:417	"rpc"	"vscode-css-language-server"	"stderr"	"/Users/nibru/.nvm/versions/node/v12.13.0/lib/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n        return this._head?.value;\n                          ^\n\nSyntaxError: Unexpected token '.'\n    at Module._compile (internal/modules/cjs/loader.js:892:18)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:724:14)\n    at Module.require (internal/modules/cjs/loader.js:849:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at Object.<anonymous> (/Users/nibru/.nvm/versions/node/v12.13.0/lib/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n    at Module._compile (internal/modules/cjs/loader.js:956:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n"
[START][2021-12-27 14:30:26] LSP logging initiated
[START][2021-12-27 14:31:22] LSP logging initiated
[START][2021-12-27 14:32:47] LSP logging initiated
[ERROR][2021-12-27 14:32:56] .../vim/lsp/rpc.lua:417	"rpc"	"vscode-css-language-server"	"stderr"	"/Users/nibru/.nvm/versions/node/v12.13.0/lib/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n        return this._head?.value;\n                          ^\n\nSyntaxError: Unexpected token '.'\n    at Module._compile (internal/modules/cjs/loader.js:892:18)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:724:14)\n    at Module.require (internal/modules/cjs/loader.js:849:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at Object.<anonymous> (/Users/nibru/.nvm/versions/node/v12.13.0/lib/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n    at Module._compile (internal/modules/cjs/loader.js:956:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n"

Conclusion

The node version is definitely a problem, but I wonder if this prevents me from using neovim for my work related projects where I have to use an older node version

My Config

This are my config files

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024 1

I'll try.

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024 1

@JensPauwels I've published the v4.0.0.

from cmp-nvim-lsp.

IrwinJuice avatar IrwinJuice commented on September 4, 2024 1

Hi,

I want to add some notes for Ubuntu users.

Today I had a similar problem. But in my case, CSS and HTML completion doesn't work because of the 'snap' package Neovim on Ubuntu.

:cheсkhealth showed something like this:

Failed to load parser: uv_dlopen: /snap/core18/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (requ
ired by /lib/x86_64-linux-gnu/libstdc++.so.6)

So I deleted 'snap' version, and install Neovim from github (because apt contain only neovim 0.4.0)

https://github.com/neovim/neovim/releases/nightly

Debian Package

Download nvim-linux64.deb
Install the package using sudo apt install ./nvim-linux64.deb
Run nvim

After that CSS and HTML completion works perfectly.

from cmp-nvim-lsp.

wgxh-cli avatar wgxh-cli commented on September 4, 2024

me too

from cmp-nvim-lsp.

nikbrunner avatar nikbrunner commented on September 4, 2024

I still have this problem. I even installed LunarVim and there exists the same problem for .css files..

from cmp-nvim-lsp.

nikbrunner avatar nikbrunner commented on September 4, 2024

That is what I have. This also worked before and still works for ts.

local nvim_lsp = require("lspconfig")

-- TODO Fix cssls completion
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)

local servers = {
  "html",
  "cssls",
  "tsserver"
}

for _, lsp in ipairs(servers) do
  nvim_lsp[lsp].setup {
    capabilities = capabilities,
  }
end

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024

I can't understand... Hm...

I'm installed the cssls by npm i -g vscode-langservers-extracted@latest.

from cmp-nvim-lsp.

nikbrunner avatar nikbrunner commented on September 4, 2024

I get this error message when I am entering an .scss file for example.
But I am not sure if that has anything to do with it.

image

When I run :CmpStatus I get this:
image

I will try your npm command and see if this causes a change

from cmp-nvim-lsp.

nikbrunner avatar nikbrunner commented on September 4, 2024

When I run the npm command the Propblem remains.
The "Client 1 quit with exit code 1 and signal 0" error still occurs and I only get text-buffer completion.

image

from cmp-nvim-lsp.

JensPauwels avatar JensPauwels commented on September 4, 2024

I just noticed an error in ~/.cache/nvim/lsp.log. This means that your plugin is probably working fine and it's due to the language server error

[ERROR][2021-12-15 09:14:31] .../vim/lsp/rpc.lua:417 "rpc" "vscode-css-language-server" "stderr" "/usr/local/lib/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n return this._head?.value;\n ^\n\nSyntaxError: Unexpected token '.'\n at wrapSafe (internal/modules/cjs/loader.js:915:16)\n at Module._compile (internal/modules/cjs/loader.js:963:27)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)\n at Module.load (internal/modules/cjs/loader.js:863:32)\n at Function.Module._load (internal/modules/cjs/loader.js:708:14)\n at Module.require (internal/modules/cjs/loader.js:887:19)\n at require (internal/modules/cjs/helpers.js:74:18)\n at Object. (/usr/local/lib/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n at Module._compile (internal/modules/cjs/loader.js:999:30)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)\n"

from cmp-nvim-lsp.

nikbrunner avatar nikbrunner commented on September 4, 2024

I have the same error in my ~/.cache/nvim/lsp.log:

[ERROR][2021-12-15 08:44:43] .../vim/lsp/rpc.lua:417	"rpc"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/.bin/vscode-css-language-server"	"stderr"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n        return this._head?.value;\n                          ^\n\nSyntaxError: Unexpected token '.'\n    at Module._compile (internal/modules/cjs/loader.js:892:18)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:724:14)\n    at Module.require (internal/modules/cjs/loader.js:849:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at Object.<anonymous> (/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n    at Module._compile (internal/modules/cjs/loader.js:956:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n"
[START][2021-12-15 08:44:58] LSP logging initiated
[ERROR][2021-12-15 08:45:00] .../vim/lsp/rpc.lua:417	"rpc"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/.bin/vscode-css-language-server"	"stderr"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n        return this._head?.value;\n                          ^\n\nSyntaxError: Unexpected token '.'\n    at Module._compile (internal/modules/cjs/loader.js:892:18)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:724:14)\n    at Module.require (internal/modules/cjs/loader.js:849:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at Object.<anonymous> (/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n    at Module._compile (internal/modules/cjs/loader.js:956:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n"
[START][2021-12-15 08:45:13] LSP logging initiated
[ERROR][2021-12-15 08:45:15] .../vim/lsp/rpc.lua:417	"rpc"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/.bin/vscode-css-language-server"	"stderr"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n        return this._head?.value;\n                          ^\n\nSyntaxError: Unexpected token '.'\n    at Module._compile (internal/modules/cjs/loader.js:892:18)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:724:14)\n    at Module.require (internal/modules/cjs/loader.js:849:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at Object.<anonymous> (/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n    at Module._compile (internal/modules/cjs/loader.js:956:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n"
[START][2021-12-15 08:48:28] LSP logging initiated
[ERROR][2021-12-15 08:48:30] .../vim/lsp/rpc.lua:417	"rpc"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/.bin/vscode-css-language-server"	"stderr"	"/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/linkedMap.js:40\n        return this._head?.value;\n                          ^\n\nSyntaxError: Unexpected token '.'\n    at Module._compile (internal/modules/cjs/loader.js:892:18)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:724:14)\n    at Module.require (internal/modules/cjs/loader.js:849:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at Object.<anonymous> (/Users/nibru/.local/share/nvim/lsp_servers/cssls/node_modules/vscode-langservers-extracted/node_modules/vscode-jsonrpc/lib/common/api.js:37:21)\n    at Module._compile (internal/modules/cjs/loader.js:956:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)\n    at Module.load (internal/modules/cjs/loader.js:812:32)\n"

from cmp-nvim-lsp.

JensPauwels avatar JensPauwels commented on September 4, 2024

Is there any news on this issue?

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024

I can't reproduce.

Kapture.2021-12-27.at.17.52.32.mp4

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024
hrsh7th$ npm ls -g vscode-langservers-extracted
/Users/hiroshi_shichita/.config/nvm/versions/node/v16.13.0/lib
└── [email protected]

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024
if has('vim_starting')
  set encoding=utf-8
endif
scriptencoding utf-8

if &compatible
  set nocompatible
endif

let s:plug_dir = expand('/tmp/plugged/vim-plug')
if !filereadable(s:plug_dir .. '/plug.vim')
  execute printf('!curl -fLo %s/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim', s:plug_dir)
end

execute 'set runtimepath+=' . s:plug_dir
call plug#begin(s:plug_dir)
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/vim-vsnip'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'neovim/nvim-lspconfig'
call plug#end()
PlugInstall | quit

lua << EOF
local cmp = require "cmp"
cmp.setup {
  snippet = {
    expand = function(args)
      vim.fn["vsnip#anonymous"](args.body)
    end,
  },

  mapping = {
    ['<CR>'] = cmp.mapping.confirm({ select = true })
  },

  sources = {
    { name = "nvim_lsp" },
  },
}

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
local lspconfig = require('lspconfig')
lspconfig.cssls.setup {
  capabilities = capabilities
}
EOF

from cmp-nvim-lsp.

JensPauwels avatar JensPauwels commented on September 4, 2024

https://github.com/JensPauwels/nvim/tree/cmp-upgrade This is a link to my nvim setup.

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024

I don't know what happens if we use both of the lspconfig and lsp-installer.

In the first place, I say that even if I made the minimum configuration, it did not reproduce. Make the minimum configuration to reproduce.

from cmp-nvim-lsp.

JensPauwels avatar JensPauwels commented on September 4, 2024

I do indeed use node 12 for compatibility with older projects.

from cmp-nvim-lsp.

dmitmel avatar dmitmel commented on September 4, 2024

@hrsh7th Try lowering the target when building components of VSCode in vscode-langservers-extracted. I think, for their internal language servers it is defined in https://github.com/microsoft/vscode/blob/main/extensions/tsconfig.base.json.

from cmp-nvim-lsp.

hrsh7th avatar hrsh7th commented on September 4, 2024

I'm trying to transpile all modules via babel (/preset-env).

from cmp-nvim-lsp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.