williamboman / mason-lspconfig.nvim

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

terraformls completion is not working #224

Open liviudm opened 1 year ago

liviudm commented 1 year ago

Problem description

Terraform completion using terraformls is not working when using the Mason installed binary on Apple Silicon Mac. The setup is pretty simple and standard, nvim-cmp, nvim-lspconfig, mason, and mason-lspconfig. I have tried several terraformls versions, 0.29.3, 0.30.3, 0.31.1, 0.31.2, all exhibit the same behavior.

The log is full of stderr messages, but from what I understand this is related to https://github.com/hashicorp/terraform-ls/issues/1271.

As a temporary fix, I installed terraform-ls using Homebrew, and overwrote cmd: https://github.com/liviudm/dotfiles/blob/main/.config/lvim/lua/plugins/lsp.lua#LL80C21-L80C21. After this change, the completion works as expected

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

Mason fetches the binaries from Hashicorp, while Homebrew compiles it. This is the only difference I was able to find.

Neovim version (>= 0.7)

NVIM v0.9.0 Build type: Release LuaJIT 2.1.0-beta3

Operating system/version

Darwin liviudm.local 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:58 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6020 arm64

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

terraformls

Steps to reproduce

Enable terraformls and open any *.tf file.

Actual behavior

LSP Completion and diagnostics is not working

Expected behavior

Completion and diagnostic messages should work

LspInfo

Press q or <Esc> to close this window. Press <Tab> to view server doc.

 Language client log: /Users/liviudm/.local/state/lvim/lsp.log
 Detected filetype:   terraform

 1 client(s) attached to this buffer: 

 Client: terraformls (id: 1, bufnr: [1])
    filetypes:       terraform, terraform-vars
    autostart:       true
    root directory:  /Users/liviudm/projects/personal/terraform/terraform-eks-base
    cmd:             /Users/liviudm/.local/share/lvim/mason/bin/terraform-ls serve

 Configured servers list: terraformls, yamlls, bashls, jsonls, lua_ls

LspLog

No response

Healthcheck

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

mason.nvim ~
- OK mason.nvim version v1.0.1
- 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-05-12-grey-stem` 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 darwin22.4.0.`
- OK curl: `curl 7.87.0 (x86_64-apple-darwin22.0) libcurl/7.87.0 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0`
- OK gzip: `Apple gzip 403.100.6`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
- OK bash: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- OK Go: `go version go1.20.4 darwin/arm64`
- 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 cargo: `cargo 1.69.0 (6e9a83356 2023-04-12)`
- OK Ruby: `ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin22]`
- WARNING javac: not available
  - ADVICE:
    - spawn: javac failed with exit code 1 and signal 0. The operation couldn’t be completed. Unable to locate a Java Runtime.
      Please visit http://www.java.com for information on installing Java.

- WARNING java: not available
  - ADVICE:
    - spawn: java failed with exit code 1 and signal 0. The operation couldn’t be completed. Unable to locate a Java Runtime.
      Please visit http://www.java.com for information on installing Java.

- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python3: `Python 3.11.3`
- OK node: `v20.1.0`
- OK luarocks: `/opt/homebrew/bin/luarocks 3.9.2`
- OK RubyGem: `3.0.3.1`
- OK pip3: `pip 23.0.1 from /opt/homebrew/lib/python3.11/site-packages/pip (python 3.11)`
- OK npm: `9.6.4`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 0. Remaining: 60. Limit: 60. Reset: Fri May 12 21:52:11 2023.
  Install and authenticate via gh-cli to increase rate limit.

Screenshots or recordings

No response

TRiggAtGM commented 1 year ago

I am experiencing similar issues on Apple Intel

williamboman commented 1 year ago

Would appreciate if someone could help debug this.

liviudm commented 1 year ago

Hi @williamboman. I can help with debugging after 12th June if it doesn’t get sorted out until then.

jbstans commented 9 months ago

Just ran into this today on Intel mac.

andrewseif commented 8 months ago

facing this problem on apple silicon

redsuperbat commented 7 months ago

Facing the same issue on apple silicon!

LukaK commented 2 months ago

Same issue on linux machines as well.

Edit: Scratch that, issue was due to limited functionality in single file mode of terraform-ls.

n-ae commented 1 month ago

faced the same issue on mac apple silicon m3. I had to manually install lsp with :Mason as an addition to this. Still new to nvim.