Every time I open VSCode in a terraform repo, I get 2 pop ups in the bottom right of the screen. See screenshot attachments.
The first is a message saying 'Installed terraform-ls 0.14.0.'. I get this every time, so I assume the install is actually failing
The second is a message is 'Couldn't start client Language Server:'
I've tried uninstalling and reinstalling the extension and uninstalling and reinstalling VSCode entirely. I've also made sure to run terraform init as well as reset the terraform.languageServer block in the settings JSON as instructed in the README.
I was able to fix this by manually downloading the language server executable and updating the settings json to point to the path.
"terraform.languageServer": {
"pathToBinary": "C:\\terraform\\terraform-ls.exe",
"external": true,
"args": [
"serve"
]
},
This works, but I would still like the VSCode extension to manage and upgrade the language server for me rather than having to manually downloading an executable.
I had the same issue - just the first part. Terraform Language Server would install on every VSCode open. Sometimes it would error, but most times it would just finish and I would close the popup. More of an annoyance than anything else. When I checked my pathToBinary property in settings, it was blank. So, I downloaded the terraform-ls.exe for my system and updated the path in settings. No more popup. My settings look the same as previous post (minus path differences), so I did not repeat it here - the above post works to solve the problem.
Adding my name to the list. I had the same issue as the OP, and when I went into settings, the language server path was a pair of double-quotes. This was working without any manual intervention prior to the 0.14 language server update.
I experience this error as well. Plugin was installed on clean VS Code.
In the console, I had:
[Error - 2:27:22 PM] Starting client failed
Error: spawn EBUSY
at ChildProcess.spawn (internal/child_process.js:407:11)
at Object.spawn (child_process.js:557:9)
at c:\Users\xxxxx\.vscode\extensions\hashicorp.terraform-2.7.0\node_modules\vscode-languageclient\lib\node\main.js:383:40
Also, a workaround, with specifying path to executable in the settings, works fine.
I don't know if anyone else does this, but I think it is worth noting that I install VS Code using Chocolatey. I am experiencing this same issue.
I don't know if anyone else does this, but I think it is worth noting that I install VS Code using Chocolatey. I am experiencing this same issue.
My install was standard windows installer. I also use a mac and settings sync, the mac behaved the same way until applying the fix. I don't think it is platform specific.
I dug into this a bit and determined it's because getLsVersion needs to look for terraform-ls.exe on Windows:
Currently the code always throws, meaning isInstalled gets set to false:
Thanks for the help digging into this, everyone! The fix was released today in v2.8.2 so if you want to confirm it, you can upgrade then remove your pathToBinary setting (if you added that).
I had the same thing, and I'm glad you guys are on it! :)
I just upgraded to v2.8.2 on my windows laptop, removed pathToBinary in settings.json and then closed/opened vscode. The first time, the popup showed terraform-ls was installing and then it confirmed it was installed - closed the popup. I then exited vscode and opened it again. It did not run the install or show the popup on the second run. Previously, it would run the terraform-ls install every time vscode was opened. I then checked my macbook, which got the updated settings from settings sync, confirmed v2.8.2 was installed and no repeating install popup. Looks good.
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.
Most helpful comment
I had the same issue - just the first part. Terraform Language Server would install on every VSCode open. Sometimes it would error, but most times it would just finish and I would close the popup. More of an annoyance than anything else. When I checked my pathToBinary property in settings, it was blank. So, I downloaded the terraform-ls.exe for my system and updated the path in settings. No more popup. My settings look the same as previous post (minus path differences), so I did not repeat it here - the above post works to solve the problem.