juliosueiras / terraform-lsp

Language Server Protocol for Terraform
MIT License
578 stars 37 forks source link

coc and terraform-lsp does not work as expected #93

Open vhristev opened 3 years ago

vhristev commented 3 years ago

There is no provider auto-completion how it's shown in the project example video.

by default 2021-02-11 at 17 53 44
~/Desktop/terraform-test/terraform/environmnet/test » ls -la
total 16
drwxr-xr-x  5 vhristev  _lpoperator   160 Feb 11 18:08 .
drwxr-xr-x  3 vhristev  _lpoperator    96 Feb 11 17:39 ..
drwxr-xr-x  3 vhristev  _lpoperator    96 Feb 11 17:40 .terraform
-rw-r--r--  1 vhristev  _lpoperator  1002 Feb 11 17:48 .terraform.lock.hcl
-rw-r--r--  1 vhristev  _lpoperator    29 Feb 11 17:48 main.tf
~ » nvim --version
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPAC

K_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/config -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/src -I/usr/local/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/src/nvim/auto -I/tmp/neovim-20200808-89283-1us0ytm/neovim-0.4.4/build/include
Compiled by brew@Catalina

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.4/share/nvim"

Run :checkhealth for more info

Terraform-lsp - i tried with Beta1 Beta2 and older versions.

I can see LSP server is runnig

~ » ps aux | grep terr
vhristev         76420   0.6  0.0  4399240  12712   ??  S     5:49PM   0:00.06 terraform-lsp

coc settings( there is extr } to close entire config )

    // python
    "python.jediEnabled": false,
    // add your languageServer into this list
    "languageserver": {
                "terraform": {
                        "command": "terraform-lsp",
                        "filetypes": [
                                "terraform",
                                "tf"
                        ],
                        "initializationOptions": {},
                        "settings": {}
                }
        }
}
jmahlik commented 3 years ago

I wonder if there might be a version conflict with terraform somewhere?

juliosueiras commented 3 years ago

can you try 0.0.12 ?

unaryops commented 2 years ago

I'm on 0.0.12 and am experiencing exactly the same issue.

alexaxms commented 2 years ago

same issue for me :c

juliosueiras commented 2 years ago

this is the coc config I use

{
   "languageserver" : {
      "terraform" : {
         "args" : [
            "serve"
         ],
         "command" : "terraform-lsp",
         "filetypes" : [
            "terraform",
            "tf"
         ],
         "rootPatterns" : [
            "*.tf",
            "terragrunt.hcl"
         ],
         "trace.server" : "verbose"
      }
   }
}
juliosueiras commented 2 years ago

@alexaxms can you try the above(and make sure is on 0.0.12 for the lsp as well as terraform init is already executed)

alexaxms commented 2 years ago

@alexaxms can you try the above(and make sure is on 0.0.12 for the lsp as well as terraform init is already executed)

it's working now, sorry I forgot the terraform init since this stack works without the init. Thanks!

juliosueiras commented 2 years ago

@alexaxms np