williamboman / mason-lspconfig.nvim

Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.
Apache License 2.0
2.55k stars 154 forks source link

Puppet langage sever errors out in nvim #341

Open genebean opened 7 months ago

genebean commented 7 months ago

Problem description

When I open a puppet manifest (a .pp file), I see this at the bottom of nvim:

LSP[puppet][Warning] An error occurred while starting the Language Server. The server has been disabled.

Running :LspLog opens an empty file. This is confirmed by listing the files in the directory where it seems to expect the log:

$ ls -lh ~/.local/state/nvim/
total 16K
drwxr-xr-x 4 gene.liverman  128 Dec 19 10:49 lazy
-rw-r--r-- 1 gene.liverman    0 Aug 17 20:46 log
-rw-r--r-- 1 gene.liverman    0 Dec 19 10:49 luasnip.log
-rw-r--r-- 1 gene.liverman   75 Dec 19 22:34 mason-registry-update
-rw-r--r-- 1 gene.liverman 8.3K Dec 19 22:34 mason.log
drwx------ 3 gene.liverman   96 Dec 19 16:11 neogit
drwxr-xr-x 5 gene.liverman  160 Dec 19 14:55 sessions
drwx------ 3 gene.liverman   96 Dec 19 23:15 shada
drwxr-xr-x 5 gene.liverman  160 Dec 20 08:54 swap
drwxr-xr-x 3 gene.liverman   96 Dec 19 14:35 undo

Checking for puppet in the mason logs shows it installed fine:

$ grep puppet ~/.local/state/nvim/mason.log
[INFO  Tue Dec 19 14:36:52 2023] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=puppet-editor-services) {}
[INFO  Tue Dec 19 14:36:58 2023] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=puppet-editor-services)
[INFO  Tue Dec 19 22:34:46 2023] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:184: Executing installer for Package(name=puppet-editor-services) {}
[INFO  Tue Dec 19 22:34:50 2023] ...e/nvim/lazy/mason.nvim/lua/mason-core/installer/init.lua:245: Installation succeeded for Package(name=puppet-editor-services)

Why do you think this is an issue with mason-lspconfig.nvim?

Mason installed the LSP to ~/.local/share/nvim/mason/packages/puppet-editor-services and if I can do this:

$ ~/.local/share/nvim/mason/packages/puppet-editor-services/puppet-languageserver
LANGUAGE SERVER RUNNING localhost:55397

That seems to indicate that the LSP runs and nvim just can't talk to it correctly... I think?

Neovim version (>= 0.7)

nvim --version NVIM v0.9.4 Build type: Release LuaJIT 2.1.1700008891

Operating system/version

Darwin Blue-Rock 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:54:10 PST 2023; root:xnu-10002.61.3~2/RELEASE_X86_64 x86_64 i386 Darwin

I've manually reviewed the Nvim LPS client log (:LspLog) to find potential errors

I've recently downloaded the latest plugin version of mason.nvim, mason-lspconfig.nvim, and nvim-lspconfig

Affected language servers

puppet

Steps to reproduce

  1. Add puppet like so: require("mason-lspconfig").setup({ ensure_installed = { "puppet", }})
  2. add require("lspconfig").puppet.setup {}
  3. edit puppet manifest
  4. see error

Actual behavior

The failure mentioned above

Expected behavior

A usable language server

LspInfo

Language client log: /Users/gene.liverman/.local/state/nvim/lsp.log
Detected filetype:   puppet

1 client(s) attached to this buffer:

Client: puppet (id: 1, bufnr: [1])
 filetypes:       puppet
 autostart:       true
 root directory:  /Users/gene.liverman/repos/dots/legacy/puppet/production/site/profile
 cmd:             /Users/gene.liverman/.local/share/nvim/mason/bin/puppet-languageserver --stdio

Configured servers list: lua_ls, puppet, ruff_lsp

LspLog

the file is empty

Healthcheck

mason: require("mason.health").check()

mason.nvim
- OK mason.nvim version v1.8.3
- OK PATH: prepend
- OK Providers:
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries]
- OK Registry github.com/mason-org/mason-registry version: 2023-12-20-mute-bichir is installed.

mason.nvim [Core utils]
- OK unzip: UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
- OK wget: GNU Wget 1.21.4 built on darwin23.1.0.
- OK curl: curl 8.4.0 (x86_64-apple-darwin23.0) libcurl/8.4.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.55.1
- OK gzip: Apple gzip 428
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.0.5 bz2lib/1.0.8
- OK bash: GNU bash, version 5.2.21(1)-release (x86_64-apple-darwin23.1.0)
- OK sh: Ok

mason.nvim [Languages]
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- OK Go: go version go1.21.5 darwin/amd64
- OK Ruby: ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-darwin22]
- OK node: v20.10.0
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK java: openjdk version "19.0.2" 2023-01-17
- OK python: Python 3.9.6
- OK RubyGem: 3.4.22
- OK javac: javac 19.0.2
- OK npm: 10.2.3
- OK pip: pip 21.2.4 from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-         packages/pip (python 3.9)
- OK python venv: Ok

mason.nvim [GitHub]
- OK GitHub API rate limit. Used: 1. Remaining: 59. Limit: 60. Reset: Wed Dec 20 10:04:10 2023.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

No response

alnet commented 7 months ago

+1. I will also add that when I manually installed the language server at the same path, neovim started working with it as expected.

genebean commented 7 months ago

Bypassing the shell script in makes it work:

require("lspconfig").puppet.setup {
  cmd = { "/Users/gene.liverman/.local/share/nvim/mason/packages/puppet-editor-services/libexec/puppet-languageserver" }
}

This makes me think it is something about ~/.local/share/nvim/mason/packages/puppet-editor-services/puppet-languageserver that is the issue here.