hashicorp / terraform-ls

Terraform Language Server
Mozilla Public License 2.0
997 stars 132 forks source link

completion fails starting with version 0.24.0 to 0.26.0(current release) #845

Closed j3ffrw closed 2 years ago

j3ffrw commented 2 years ago

Server Version

0.24.0
0.25.0
0.26.0

Terraform Version

Terraform v1.0.11
on linux_amd64

Client Version

vim version: VIM - Vi IMproved 8.2 8023512                                                                               
node version: v12.22.11                                                                                                  
coc.nvim version: 0.0.80-d0ba54c9 2022-03-30 18:45:24 +0800                                                              
coc.nvim directory: /home/my/.vim/plugged/coc.nvim                                                                      
term: dumb                                                                                                               
platform: linux                                                                                                            

## Log of coc.nvim                                                                                                       

2022-04-01T17:59:21.595 INFO (pid:62039) [services] - registered service "languageserver.terraform"                      
2022-04-01T17:59:21.605 INFO (pid:62039) [plugin] - coc.nvim initialized with node: v12.22.11 after 42ms

Terraform Configuration Files

# test.tf
resource 

Log Output

woking on 0.23.0 https://gist.github.com/j3ffrw/48bedc4a719d0243139b918cb2930522#file-terraform-ls-0-23-0-1-log
not working on 0.24.0 https://gist.github.com/j3ffrw/48bedc4a719d0243139b918cb2930522#file-terraform-ls-0-24-0-1-log

Expected Behavior

completion should work Screenshot from 2022-04-01 18-15-40

Actual Behavior

completion fails, with unknown language id "tf" in the logs

Steps to Reproduce

  1. vim test.tf in a terraform project
  2. Trigger autocompletion by typing resource
radeksimko commented 2 years ago

completion fails, with unknown language id "tf" in the logs

I don't know all the implementation details of coc.nvim plugin myself but generally speaking the language server expects and supports two documented language IDs - terraform and terraform-vars. Language ID is usually implied from the file extension, but it is a different and not interchangeable concept, so if for any reason the editor ends up sending tf instead of terraform then that's a problem that will need rectifying there (on the editor/client side).

Before we start digging into the client code, can you share your configuration and/or confirm it matches https://github.com/hashicorp/terraform-ls/blob/main/docs/USAGE.md#cocnvim ?

Thanks!

radeksimko commented 2 years ago

As a side note NeoVIM 0.5.0+ has a builtin language client which may be easier to configure, see https://github.com/hashicorp/terraform-ls/blob/main/docs/USAGE.md#neovim-v050

j3ffrw commented 2 years ago

Thank you for the additional info about language id, I manage to fix it in vim by using

set ft=terraform

but ended up installing 'hashivim/vim-terraform' w/c does the above and a lot more. Works with 0.26.0 too.

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.