Vscode-terraform: Language server requires `serve` argument to start up, differs from previous language server

Created on 11 Jun 2020  ยท  7Comments  ยท  Source: hashicorp/vscode-terraform

After upgrading to v2.0.1 the language server crashes permanently.
image

VS-Code v1.46.0 is running on MacOS 10.15.5.

Most helpful comment

Oh, I figured my issue out, maybe the same for others:

In my workspace I had a .vscode/settings.json file left over from the previous extension. It had - you guessed it - language server setting overrides.

{
  "terraform.languageServer": {
    "enabled": true,
    "args": []
  }
}

So... yeah, empty arg array. Removing the settings.json from the workspace got the language server working for me. I gather the previous language server didn't require default args.

All 7 comments

Work around that worked for me is to put in (in settings.ini)
```
"pathToBinary": "/Users/xxx/.vscode/extensions/hashicorp.terraform-2.0.1/lsp/terraform-ls",

Same issue, same versions

  • Terraform plugin 2.0.1
  • VS Code 1.46.0
  • MacOS 10.15.5

Log from output window:

Launching language server: /Users/tillig/.vscode/extensions/hashicorp.terraform-2.0.1/lsp/terraform-ls 
Usage: terraform-ls [--version] [--help] <command> [<args>]

Available commands are:
    completion    Lists available completion items
    serve         Starts the Language Server

[Info  - 6:47:11 AM] Connection to server got closed. Server will restart.
Usage: terraform-ls [--version] [--help] <command> [<args>]

Available commands are:
    completion    Lists available completion items
    serve         Starts the Language Server

[Info  - 6:47:11 AM] Connection to server got closed. Server will restart.
Usage: terraform-ls [--version] [--help] <command> [<args>]

Available commands are:
    completion    Lists available completion items
    serve         Starts the Language Server

[Info  - 6:47:11 AM] Connection to server got closed. Server will restart.
Usage: terraform-ls [--version] [--help] <command> [<args>]

Available commands are:
    completion    Lists available completion items
    serve         Starts the Language Server

[Info  - 6:47:11 AM] Connection to server got closed. Server will restart.
Usage: terraform-ls [--version] [--help] <command> [<args>]

Available commands are:
    completion    Lists available completion items
    serve         Starts the Language Server

[Error - 6:47:11 AM] Connection to server got closed. Server will not be restarted.

I do see the default args in my settings.json:

{
    "terraform.languageServer": {
        "external": true,
        "args": [
            "serve"
        ]
    }
}

But I also see that I should be seeing a line that says something like:

Launching language server: /.../terraform-ls serve

That is, the args should be there because they should be getting read from config but I don't see the serve arg in the log. I'm guessing something is messed up with the configuration reading...?

Oh, I figured my issue out, maybe the same for others:

In my workspace I had a .vscode/settings.json file left over from the previous extension. It had - you guessed it - language server setting overrides.

{
  "terraform.languageServer": {
    "enabled": true,
    "args": []
  }
}

So... yeah, empty arg array. Removing the settings.json from the workspace got the language server working for me. I gather the previous language server didn't require default args.

Going to close this since it seems to just be a config mismatch. I re-titled it to improve discoverability, I'll also update the README with default configuration.

Update added in d9f1b5a86b8eb6c4fdb3330fdd6bd93c333006de

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisgallivan picture chrisgallivan  ยท  4Comments

domenjesenovec picture domenjesenovec  ยท  6Comments

avinashkavi447 picture avinashkavi447  ยท  7Comments

mdschweda picture mdschweda  ยท  3Comments

jacobisaliveandwell picture jacobisaliveandwell  ยท  3Comments