Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete does not work with NVIM 0.7 #936

Closed
charles-d-burton opened this issue Jun 1, 2022 · 5 comments
Closed

Autocomplete does not work with NVIM 0.7 #936

charles-d-burton opened this issue Jun 1, 2022 · 5 comments
Labels
bug Something isn't working editor/neovim https://neovim.io/ waiting-response

Comments

@charles-d-burton
Copy link

Server Version

0.27.0

Terraform Version

terraform version
Terraform v1.2.2
on linux_amd64

Client Version

 nvim --version
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by runner@fv-az316-460

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

Terraform Configuration Files

Literally anything

Log Output

ERROR][2022-06-01 17:52:35] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:35 opts.go:218: Received request batch of size 1 (qlen=0)\n2022/06/01 17:52:35 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n2022/06/01 17:52:35 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf","version":22},"contentChanges":[{"range":{"start":{"line":33,"character":10},"end":{"line":33,"character":10}},"text":"i","rangeLength":0}]}\n2022/06/01 17:52:35 opts.go:218: Discarding error from notification to "textDocument/didChange": file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n'
[ERROR][2022-06-01 17:52:35] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	"2022/06/01 17:52:35 opts.go:218: Received request batch of size 1 (qlen=0)\n"
[ERROR][2022-06-01 17:52:35] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	"2022/06/01 17:52:35 opts.go:218: Received request batch of size 1 (qlen=1)\n2022/06/01 17:52:35 opts.go:218: Received request batch of size 1 (qlen=2)\n2022/06/01 17:52:35 opts.go:218: Dequeued request batch of length 1 (qlen=2)\n"
[ERROR][2022-06-01 17:52:35] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:35 opts.go:218: Dequeued request batch of length 1 (qlen=1)\n2022/06/01 17:52:35 rpc_logger.go:29: Incoming notification for "$/cancelRequest": {"id":11}\n'
[ERROR][2022-06-01 17:52:35] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	"2022/06/01 17:52:35 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n"
[ERROR][2022-06-01 17:52:35] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:35 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf","version":24},"contentChanges":[{"range":{"start":{"line":33,"character":10},"end":{"line":33,"character":11}},"text":"","rangeLength":1},{"range":{"start":{"line":33,"character":10},"end":{"line":33,"character":10}},"text":"i","rangeLength":0}]}\n2022/06/01 17:52:35 opts.go:218: Discarding error from notification to "textDocument/didChange": file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n2022/06/01 17:52:35 rpc_logger.go:29: Incoming request for "textDocument/completion" (ID 12): {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf"},"position":{"line":33,"character":11},"context":{"triggerKind":1}}\n2022/06/01 17:52:35 rpc_logger.go:45: Error for "textDocument/completion" (ID 12): [-32098] file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n2022/06/01 17:52:35 opts.go:218: Completed 1 requests [172.049µs elapsed]\n'
[ERROR][2022-06-01 17:52:35] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:35 opts.go:218: Received request batch of size 1 (qlen=0)\n2022/06/01 17:52:35 opts.go:218: Received request batch of size 1 (qlen=1)\n2022/06/01 17:52:35 opts.go:218: Received request batch of size 1 (qlen=2)\n2022/06/01 17:52:35 opts.go:218: Dequeued request batch of length 1 (qlen=2)\n2022/06/01 17:52:35 opts.go:218: Dequeued request batch of length 1 (qlen=1)\n2022/06/01 17:52:35 rpc_logger.go:29: Incoming notification for "$/cancelRequest": {"id":12}\n2022/06/01 17:52:35 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n2022/06/01 17:52:35 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf","version":25},"contentChanges":[{"range":{"start":{"line":33,"character":11},"end":{"line":33,"character":11}},"text":"a","rangeLength":0}]}\n2022/06/01 17:52:35 opts.go:218: Discarding error from notification to "textDocument/didChange": file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n2022/06/01 17:52:35 rpc_logger.go:29: Incoming request for "textDocument/completion" (ID 13): {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf"},"position":{"line":33,"character":12},"context":{"triggerKind":1}}\n2022/06/01 17:52:35 rpc_logger.go:45: Error for "textDocument/completion" (ID 13): [-32098] file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n2022/06/01 17:52:35 opts.go:218: Completed 1 requests [118.719µs elapsed]\n'
[ERROR][2022-06-01 17:52:36] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:36 opts.go:218: Received request batch of size 1 (qlen=0)\n2022/06/01 17:52:36 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n2022/06/01 17:52:36 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf","version":26},"contentChanges":[{"range":{"start":{"line":33,"character":12},"end":{"line":33,"character":12}},"text":"m","rangeLength":0}]}\n'
[ERROR][2022-06-01 17:52:36] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:36 opts.go:218: Discarding error from notification to "textDocument/didChange": file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n'
[ERROR][2022-06-01 17:52:36] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:36 opts.go:218: Received request batch of size 1 (qlen=0)\n2022/06/01 17:52:36 opts.go:218: Received request batch of size 1 (qlen=1)\n2022/06/01 17:52:36 opts.go:218: Dequeued request batch of length 1 (qlen=1)\n2022/06/01 17:52:36 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n2022/06/01 17:52:36 rpc_logger.go:29: Incoming notification for "$/cancelRequest": {"id":13}\n2022/06/01 17:52:36 rpc_logger.go:29: Incoming request for "textDocument/completion" (ID 14): {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf"},"position":{"line":33,"character":13},"context":{"triggerKind":1}}\n2022/06/01 17:52:36 rpc_logger.go:45: Error for "textDocument/completion" (ID 14): [-32098] file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n2022/06/01 17:52:36 opts.go:218: Completed 1 requests [123.385µs elapsed]\n'
[ERROR][2022-06-01 17:52:37] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:37 opts.go:218: Received request batch of size 1 (qlen=0)\n2022/06/01 17:52:37 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n2022/06/01 17:52:37 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf","version":27},"contentChanges":[{"range":{"start":{"line":33,"character":0},"end":{"line":34,"character":0}},"text":"","rangeLength":14}]}\n2022/06/01 17:52:37 opts.go:218: Discarding error from notification to "textDocument/didChange": file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n'
[ERROR][2022-06-01 17:52:37] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	"2022/06/01 17:52:37 opts.go:218: Received request batch of size 1 (qlen=0)\n2022/06/01 17:52:37 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n"
[ERROR][2022-06-01 17:52:37] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:37 rpc_logger.go:29: Incoming request for "textDocument/formatting" (ID 15): {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf"},"options":{"tabSize":4,"insertSpaces":true}}\n'
[ERROR][2022-06-01 17:52:37] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:37 rpc_logger.go:45: Error for "textDocument/formatting" (ID 15): [-32098] file:///home/charles/Development/platform-infra/stack/services/analytics-service/env/develop/terraform/main.tf: document not found\n2022/06/01 17:52:37 opts.go:218: Completed 1 requests [226.936µs elapsed]\n'
[ERROR][2022-06-01 17:52:37] .../vim/lsp/rpc.lua:420	"rpc"	"terraform-ls"	"stderr"	'2022/06/01 17:52:37 opts.go:218: Received request batch of size 1 (qlen=0)\n2022/06/01 17:52:37 opts.go:218: Dequeued request batch of length 1 (qlen=0)\n2022/06/01 17:52:37 rpc_logger.go:29: Incoming notification for "textDocument/didSave": {"textDocument":{"uri":"file:\\/\\/\\/home\\/charles\\/Development\\/platform-infra\\/stack\\/services\\/analytics-service\\/env\\/develop\\/terraform\\/main.tf"}}\n'

Expected Behavior

It should autocomplete

Actual Behavior

Nothing, just throws errors in the log

Steps to Reproduce

1: Create a terraform module
2: Open with nvim and configure like this

let g:coq_settings = { 'auto_start': v:true }                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                
  lua <<EOF                                                                                                                                                                                                                                                                                     
      local lspconfig = require'lspconfig'                                                                                                                                                                                                                                                      
      local coq = require'coq'                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                
      local capabilities = vim.lsp.protocol.make_client_capabilities()                                                                                                                                                                                                                          
      capabilities.textDocument.completion.completionItem.snippetSupport = true                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                
      util = require "lspconfig/util"                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
      lspconfig.terraformls.setup{}                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                                
  EOF                                                                                                                                                                                                                                                                                           
                                                                                                                                                                                                                                                                                                
  autocmd BufWritePre *.tf lua vim.lsp.buf.formatting_sync()     
@charles-d-burton
Copy link
Author

As far as I can tell it doesn't work for anything. I can't get it to work with VSCode or LunarVIm.

@jpogran
Copy link
Contributor

jpogran commented Jun 2, 2022

Sorry you're experiencing these issues @charles-d-burton.

I think the neovim issue you're running into is neovim/neovim#18734, which we discovered in #927 (comment). Unfortunately there isn't an immediate fix, the neovim side hasn't been picked up yet and we haven't addressed #310 yet. You can keep track of #310 to see when we address this server side.

I haven't used LunarVim, but can confirm autocomplete works for VS Code. Are you using VSCodium or official VS Code builds? I ask because the build available for VSCodium is old and we are waiting for Eclipse to update some tools we need to publish a new one.

If you are using an official VS Code build, can you post the version of the Terraform Extension and VS Code and attach logs from the Output pane here?

@radeksimko
Copy link
Member

Re NeoVim:
It is likely that you may be running into the issue @jpogran mentioned with duplicate change events, but could you provide us more log lines, so we can confirm that? The lines you pasted start with didChange notification already erroring with document not found, there must be some earlier didChange notifications above what you pasted.

@radeksimko
Copy link
Member

@charles-d-burton We have just released 0.28.0 which contains #940 - that should avoid "hard stop" when the mentioned events occur - duplicate versions are now ignored.

We still continue to log such events, to provide the opportunity to discover and fix these client-side bugs.

Let us know if you continue having issues after upgrading.

@github-actions
Copy link

github-actions bot commented Jul 9, 2022

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working editor/neovim https://neovim.io/ waiting-response
Projects
None yet
Development

No branches or pull requests

3 participants