vscode-terraform: "Couldn't start client Terraform LS" error despite installing language server via extension/brew

Extension version:

2.14.0

My Environment

  • macOS Big Sur 11.5.1
  • VSCode 1.58.2 (Universal)

Expected Behavior

  • When I run the command Terraform: Enable Language Server, the command should validate open .tf files.

Actual Behavior

  • When I run the command Terraform: Enable Language Server, I get an error message “Couldn’t start client Terraform LS”.

Steps to reproduce the problem (?)

  • Install extension
  • Open a .tf file (?)
  • Accept prompt to install 0.20.0 version of Terraform language server. Reload VSCode

OR

  • Install Language Server via brew with brew install hashicorp/tap/terraform-ls
  • Install extension
  • Configure settings.json as follows:
    "terraform.languageServer": {
         "external": true,
         "pathToBinary": "/usr/local/bin/terraform-ls",
         "args": [
             "serve"
         ],
         "maxNumberOfProblems": 100,
         "trace.server": "off"
     },
  • Open a .tf file (?)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Based on the file paths, it looks like you installed the extension into VS Codium or similar build of VS Code, which generally doesn’t install from the MS Marketplace. The latest builds on OpenVSX - which you likely used - are currently broken, because of an older version of ovsx was used which doesn’t support multi-platform extensions. We are currently blocked by https://github.com/eclipse/openvsx/issues/450

Since v2.20.0 we embed the LS binary in the extension itself (within vsix), so folks who consume the extension via official VS Code builds and MS Marketplace should no longer face this error.

We track OpenVSX publishing under https://github.com/hashicorp/vscode-terraform/pull/1064

@AllAwesome497 We also provide terraform-ls package for various Linux distributions, so you don’t have to build LS yourself: https://www.hashicorp.com/official-packaging-guide (terraform-ls is the package name).