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

Saving files hangs on "Running 'HashiCorp Terraform' Formatter" #402

Closed
aprice opened this issue Jun 18, 2020 · 13 comments
Closed

Saving files hangs on "Running 'HashiCorp Terraform' Formatter" #402

aprice opened this issue Jun 18, 2020 · 13 comments

Comments

@aprice
Copy link

aprice commented Jun 18, 2020

VS Code:

Version: 1.46.0
Commit: a5d1cc28bb5da32ec67e86cc50f84c67cc690321
Date: 2020-06-10T08:59:04.923Z
Electron: 7.3.1
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.3.11-100.fc29.x86_64

Since updating to v2 of the plugin (specifically running v2.0.1 right now), every time I save a file, I get a toast for running the formatter that persists indefinitely without saving the file until I click Cancel, at which point it saves but does not format. I can then run terraform fmt on the same file without issue. Clicking "Configure" just takes me to the Terraform extension settings, which has no UI-enabled settings and just directs to edit the JSON.

image

The Terraform output tab is empty. terraform-ls output shows this error, which relates to hashicorp/terraform-ls#137

2020/06/18 10:03:38 server.go:469: Received 1 new requests
2020/06/18 10:03:38 server.go:165: Processing 1 requests
2020/06/18 10:03:38 server.go:223: Checking request for "workspace/didChangeWatchedFiles": {"changes":[{"uri":"file:///home/adrian/terraform/modules/service_stack/service_elb/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/04749bd2548078d77d7993e7fefcbbbc/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/07e94a3c4e8f8cfe11d84368e50ad283/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/1303c6026bfd8cc7306f71f24671e3f0/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/14164c4c9efc2aaddf36b5441342487b/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/1b03fbc5a1f3adff76ac79d4112005f6/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/1bf34455614cdbfb74075175838239bc/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/1fe70e61320db29aa1b4d1d25d9363bc/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/24fd83d3d7f59f34cca73410a2ed33a5/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/2d23c093292d6c65577d55266336a1d8/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/2edddc61412d667259c1cd93b283ebfa/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/2f9d8277a3e707ccf8eefe69a701f379/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/33b3a637364527e5bc1caf243a32c8ec/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/34e140fbad152764ca49f1c68c3e042b/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/3622a3d03479e3d28eb12ffd197bb04b/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/3af079c9f00dd770efce4d46f5afa197/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/3b49be45c456b8f52ee4b9a9103c301d/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/3f31fe1b98a1b981dcdfc6eab438d5f3/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/415577fa47fe0961b3839f03eced2b0d/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/421fd0795bbeb0dca84abd97bed12ccd/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/65b767e276281bbabd0cfb529370b39a/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/72d544ab1dc162ea4900ab901c51d6f9/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/7ed64c44a13ef05b1f590e3db0963be5/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/82d34b9d68c05d2e8271e84d48d121d5/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/8d06ab5c83e6cd13582b9326d21617e9/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/90185587a8d66c81d9f2fe81b3d8368b/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/96fe8a32b10324eb9d9d7a2d59725c8b/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/a38ffd779c072fac0954161b8e85620a/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/a37b8b4d15e9418d5be5be6c5db32cb5/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/a3f945400a72d109b56bbe2657e4f523/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/a52ec027bb7496ccaba46cf0d64a84e9/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/a5caa31ad8d8cea587e84ef0febdeb09/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/a98defaafdf68ea286bcde8a545dd1af/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/aa7a117e716556976f75d2cb3ecebea8/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/b2d6557cf464c5c8e8e817190550e05c/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/b69cb7d8908bdd05ba4e96ee72d2a4ed/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/bdc6d576ef47516676ce09956a7935e0/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/c2ea7eeeec51a973aaddd3f939e1c073/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/c58ea107dbd63986f03acf1486da2cbb/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/c781afdf3c64029c4dc22009bfa9af62/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/c9e0add72caaabba93a5de823783f90e/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/cbd70582c8bff26e72f4255d7feb325d/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/e229f79e483c997b05be601d74c4115c/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/e753ac23213c8ba2edc9a52cfcc023a7/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/eb060099fc403413ba2728f4c0b706d7/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/f7aa25a4af66d31c9c4cc325e58e754e/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/fa3f28e8c71dcf34b24c36519627cd78/main.tf","type":2},{"uri":"file:///home/adrian/terraform/.terraform/modules/fa57609ab603f0264b8631050a823f24/main.tf","type":2}]}
2020/06/18 10:03:38 server.go:245: Task error: [-32601] no such method "workspace/didChangeWatched
@radeksimko
Copy link
Member

Hi @aprice
do you mind providing more lines of the log, than just last 4, so we can better understand the issue and maybe even try to reproduce it?

Thanks!

@gfdsa
Copy link

gfdsa commented Jun 22, 2020

Hi @radeksimko
It is quite a task to remove all the sensitive references from the complete log. Can I send it to you directly somehow?

@radeksimko
Copy link
Member

@gfdsa Feel free to encrypt it with our PGP key as per https://www.hashicorp.com/security#secure-communications and paste the encrypted log to a gist. Alternatively my email address is my first name at hashicorp.com.

@gfdsa
Copy link

gfdsa commented Jun 22, 2020

https://gist.github.com/gfdsa/a8ce789683580ed0e7998c7e3f856d04
the log from the start and until on a save the message pops up
the two bits below show the processes hung, one idle and the other in a loop trying to signal something as per the strace bit.
I've disabled the server for now, let me know if there is more info I can provide to help.

@thefotios
Copy link

I'm hitting this as well. My guess is that it's due to that method not being implemented in terraform-ls hashicorp/terraform-ls#15.

@ghost ghost removed the waiting-response label Jun 23, 2020
@aprice
Copy link
Author

aprice commented Jun 23, 2020

Here is a complete log from terraform-ls panel of making a change, saving the file, waiting a minute on the formatter, then clicking Cancel on the dialog:

2020/06/23 13:27:12 server.go:469: Received 1 new requests
2020/06/23 13:27:12 server.go:165: Processing 1 requests
2020/06/23 13:27:12 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///home/adrian/terraform/core-legacy.tf","version":55},"contentChanges":[{"range":{"start":{"line":98,"character":0},"end":{"line":98,"character":0}},"rangeLength":0,"text":" "}]}
2020/06/23 13:27:13 server.go:469: Received 1 new requests
2020/06/23 13:27:13 server.go:469: Received 1 new requests
2020/06/23 13:27:13 server.go:165: Processing 1 requests
2020/06/23 13:27:13 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///home/adrian/terraform/core-legacy.tf","version":56},"contentChanges":[{"range":{"start":{"line":98,"character":0},"end":{"line":98,"character":1}},"rangeLength":1,"text":""}]}
2020/06/23 13:27:13 server.go:165: Processing 1 requests
2020/06/23 13:27:13 server.go:223: Checking request for "textDocument/formatting": {"textDocument":{"uri":"file:///home/adrian/terraform/core-legacy.tf"},"options":{"tabSize":2,"insertSpaces":true}}
2020/06/23 13:27:57 server.go:469: Received 1 new requests
2020/06/23 13:27:57 server.go:165: Processing 1 requests
2020/06/23 13:27:57 server.go:223: Checking request for "$/cancelRequest": {"id":120}
2020/06/23 13:27:57 server.go:469: Received 1 new requests
2020/06/23 13:27:57 server.go:165: Processing 1 requests
2020/06/23 13:27:57 server.go:223: Checking request for "workspace/didChangeWatchedFiles": {"changes":[{"uri":"file:///home/adrian/terraform/core-legacy.tf","type":2}]}
2020/06/23 13:27:57 server.go:245: Task error: [-32601] no such method "workspace/didChangeWatchedFiles"
2020/06/23 13:28:03 server.go:469: Received 1 new requests
2020/06/23 13:28:03 server.go:165: Processing 1 requests
2020/06/23 13:28:03 server.go:223: Checking request for "workspace/didChangeWatchedFiles": {"changes":[{"uri":"git:/home/adrian/terraform/modules/service_stack/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fvariables.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fvariables.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fmain.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fmain.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/registration.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fregistration.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmain.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fmain.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fmain.tf%22%2C%22ref%22%3A%22%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fvariables.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fvariables.tf%22%2C%22ref%22%3A%22%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fmain.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fmain.tf%22%2C%22ref%22%3A%22%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fvariables.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fvariables.tf%22%2C%22ref%22%3A%22%22%7D","type":2}]}
2020/06/23 13:28:03 server.go:245: Task error: [-32601] no such method "workspace/didChangeWatchedFiles"
2020/06/23 13:28:10 server.go:469: Received 1 new requests
2020/06/23 13:28:10 server.go:165: Processing 1 requests
2020/06/23 13:28:10 server.go:223: Checking request for "workspace/didChangeWatchedFiles": {"changes":[{"uri":"git:/home/adrian/terraform/modules/service_stack/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fvariables.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fvariables.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fmain.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fmain.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/registration.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fregistration.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmain.tf%22%2C%22ref%22%3A%22~%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fmain.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fmain.tf%22%2C%22ref%22%3A%22%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fvariables.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fvariables.tf%22%2C%22ref%22%3A%22%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fmain.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/main.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fmain.tf%22%2C%22ref%22%3A%22%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fvariables.tf%22%2C%22ref%22%3A%22HEAD%22%7D","type":2},{"uri":"git:/home/adrian/terraform/modules/service_stack/service_elb/variables.tf?%7B%22path%22%3A%22%2Fhome%2Fadrian%2Fterraform%2Fmodules%2Fservice_stack%2Fservice_elb%2Fvariables.tf%22%2C%22ref%22%3A%22%22%7D","type":2}]}
2020/06/23 13:28:10 server.go:245: Task error: [-32601] no such method "workspace/didChangeWatchedFiles"

@tsubasaogawa
Copy link

tsubasaogawa commented Jun 25, 2020

I'm the same. (vscode 1.46.1, Terraform plugin 2.0.2)
Rebooting vscode will stop the error.

I think it is likely to see the error when I save the file with incorrect syntax.

@weeco
Copy link

weeco commented Jun 26, 2020

Same here,
VSCode 1.46.1
Terraform 2.0.2

It's 100% reproducible on two terraform files within my project so I assume what @tsubasaogawa said is correct. While VSCode is showing that window I can see the terraform-ls process using 100% CPU (1 core)

@afmsavage
Copy link

I was seeing a similar issue where my Terraform files were not being formatted on save as I have configured in my settings.json file. I ran the command Terraform: Enable Language Server inside VSCode again to see and all of a sudden it now works but with errors in the terraform-ls output. Here's my sanitized log from there:

2020/06/29 14:35:40 server.go:469: Received 1 new requests
2020/06/29 14:35:40 server.go:165: Processing 1 requests
2020/06/29 14:35:40 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":17},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":24}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:40 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":17},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":24}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:46 server.go:469: Received 1 new requests
2020/06/29 14:35:46 server.go:165: Processing 1 requests
2020/06/29 14:35:46 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":18},"contentChanges":[{"range":{"start":{"line":7,"character":22},"end":{"line":7,"character":23}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:46 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":18},"contentChanges":[{"range":{"start":{"line":7,"character":22},"end":{"line":7,"character":23}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:55 server.go:469: Received 1 new requests
2020/06/29 14:35:55 server.go:165: Processing 1 requests
2020/06/29 14:35:55 server.go:223: Checking request for "textDocument/formatting": {"textDocument":{"uri":"file:///...ec2.tf"},"options":{"tabSize":2,"insertSpaces":true}}
2020/06/29 14:35:55 rpc_logger.go:29: Incoming request for "textDocument/formatting" (ID 9): {"textDocument":{"uri":"file:///...ec2.tf"},"options":{"tabSize":2,"insertSpaces":true}}
2020/06/29 14:35:55 root_module_manager.go:117: direct root module lookup succeeded: c:\
2020/06/29 14:35:55 exec.go:146: Waiting for command to finish ...
2020/06/29 14:35:55 exec.go:172: terraform run (terraform.exe ["terraform" "fmt" "-"], in "c:", pid 8200) finished with exit code 0
2020/06/29 14:35:55 rpc_logger.go:50: Response to "textDocument/formatting" (ID 9): [{"range":{"start":{"line":7,"character":0},"end":{"line":8,"character":0}},"newText":"  key_name               = local.keypair\r\n"}]
2020/06/29 14:35:55 server.go:204: Completed 1 requests [357.0093ms elapsed]
2020/06/29 14:35:55 server.go:469: Received 1 new requests
2020/06/29 14:35:55 server.go:165: Processing 1 requests
2020/06/29 14:35:55 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":19},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":23}},"rangeLength":0,"text":"  "}]}
2020/06/29 14:35:55 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":19},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":23}},"rangeLength":0,"text":"  "}]}
2020/06/29 14:35:55 server.go:469: Received 1 new requests
2020/06/29 14:35:55 server.go:165: Processing 1 requests
2020/06/29 14:35:55 server.go:223: Checking request for "workspace/didChangeWatchedFiles": {"changes":[{"uri":"file:///...ec2.tf","type":2}]}
2020/06/29 14:35:55 server.go:245: Task error: [-32601] no such method "workspace/didChangeWatchedFiles"

Terraform settings in vscode's settings.json

"[terraform]": {
        "editor.formatOnSave": true
    },

Versions
Windows 10
VScode - 1.47.0-insider
terraform extension - 2.0.2

@mjhuber
Copy link

mjhuber commented Jun 30, 2020

I am seeing this as well

MacOS
VSCode - 1.46
terraform extension - 2.0.2

@afmsavage
Copy link

I was seeing a similar issue where my Terraform files were not being formatted on save as I have configured in my settings.json file. I ran the command Terraform: Enable Language Server inside VSCode again to see and all of a sudden it now works but with errors in the terraform-ls output. Here's my sanitized log from there:

2020/06/29 14:35:40 server.go:469: Received 1 new requests
2020/06/29 14:35:40 server.go:165: Processing 1 requests
2020/06/29 14:35:40 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":17},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":24}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:40 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":17},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":24}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:46 server.go:469: Received 1 new requests
2020/06/29 14:35:46 server.go:165: Processing 1 requests
2020/06/29 14:35:46 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":18},"contentChanges":[{"range":{"start":{"line":7,"character":22},"end":{"line":7,"character":23}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:46 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":18},"contentChanges":[{"range":{"start":{"line":7,"character":22},"end":{"line":7,"character":23}},"rangeLength":1,"text":""}]}
2020/06/29 14:35:55 server.go:469: Received 1 new requests
2020/06/29 14:35:55 server.go:165: Processing 1 requests
2020/06/29 14:35:55 server.go:223: Checking request for "textDocument/formatting": {"textDocument":{"uri":"file:///...ec2.tf"},"options":{"tabSize":2,"insertSpaces":true}}
2020/06/29 14:35:55 rpc_logger.go:29: Incoming request for "textDocument/formatting" (ID 9): {"textDocument":{"uri":"file:///...ec2.tf"},"options":{"tabSize":2,"insertSpaces":true}}
2020/06/29 14:35:55 root_module_manager.go:117: direct root module lookup succeeded: c:\
2020/06/29 14:35:55 exec.go:146: Waiting for command to finish ...
2020/06/29 14:35:55 exec.go:172: terraform run (terraform.exe ["terraform" "fmt" "-"], in "c:", pid 8200) finished with exit code 0
2020/06/29 14:35:55 rpc_logger.go:50: Response to "textDocument/formatting" (ID 9): [{"range":{"start":{"line":7,"character":0},"end":{"line":8,"character":0}},"newText":"  key_name               = local.keypair\r\n"}]
2020/06/29 14:35:55 server.go:204: Completed 1 requests [357.0093ms elapsed]
2020/06/29 14:35:55 server.go:469: Received 1 new requests
2020/06/29 14:35:55 server.go:165: Processing 1 requests
2020/06/29 14:35:55 server.go:223: Checking request for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":19},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":23}},"rangeLength":0,"text":"  "}]}
2020/06/29 14:35:55 rpc_logger.go:29: Incoming notification for "textDocument/didChange": {"textDocument":{"uri":"file:///...ec2.tf","version":19},"contentChanges":[{"range":{"start":{"line":7,"character":23},"end":{"line":7,"character":23}},"rangeLength":0,"text":"  "}]}
2020/06/29 14:35:55 server.go:469: Received 1 new requests
2020/06/29 14:35:55 server.go:165: Processing 1 requests
2020/06/29 14:35:55 server.go:223: Checking request for "workspace/didChangeWatchedFiles": {"changes":[{"uri":"file:///...ec2.tf","type":2}]}
2020/06/29 14:35:55 server.go:245: Task error: [-32601] no such method "workspace/didChangeWatchedFiles"

Terraform settings in vscode's settings.json

"[terraform]": {
        "editor.formatOnSave": true
    },

Versions
Windows 10
VScode - 1.47.0-insider
terraform extension - 2.0.2

I lied. I guess this worked once or twice for me but is no longer the case. I'm wondering if this may be due to me being on insider build and one of the nightly builds messing it up between then and now. Posting build of current vscode insiders.

Version: 1.47.0-insider (user setup)
Commit: b16b467d3e03e1a1ae05b5836e4e5a5af504e86d
Date: 2020-07-01T05:32:07.483Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.19041

@paultyng
Copy link
Contributor

paultyng commented Jul 8, 2020

There have been a number of fixes in the LS that possibly address what was going on here, going to close, but please let me know if you are still experiencing it and we can dig in deeper.

@paultyng paultyng closed this as completed Jul 8, 2020
@ghost
Copy link

ghost commented Aug 7, 2020

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 context necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Aug 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants