sts4
sts4 copied to clipboard
Add terraform language server for eclipse
Expected Behavior
It would be great if I could effectively edit Terraform files in STS
Current Behavior
All I get is a text editor
Context
Terraform provides a Language Server (https://github.com/hashicorp/terraform-ls) but it appears nobody from the eclipse community has stepped up and created an Eclipse plugin wrapping that language server. Perhaps this team would consider creating such a plugin to make it available to Eclipse STS customers? :)
I don't expect us to fully implement an Eclipse plugin to integrate this language server anytime soon, but similar to the steps described here for IntelliJ (https://github.com/hashicorp/terraform-ls/blob/main/docs/USAGE.md#intellij-ide), you should be able to integrate this language server into your Eclipse via configuration only.
LSP4E (the LSP integration for Eclipse) allows you to associate a content-type with a launch configuration for a language server. I haven't done this yet, but it looks like you would need:
- an external tool launch configuration to run the language server executable on your machine
- a content-type for the type of files this language server should be activated for
- a config in the
Language Servers
preference to combine both (the section below the list of pre-defined language servers)
Let's try this to see if we can make this work. Happy to help you here if you stumble upon anything along the way.
Thanks for the tips @martinlippert! With your instructions I was able to get the language server working and that coupled with the liclipse plugin and a terraform textmate bundle I now have a syntax higlighted terraform editor with some syntax validation!
The only minor annoyance is the terraform language server startup with as a console. I tried disabling "Allocate console" in the External Tools Configuration but then the language server doesn't work at all. Any tips for that one?
Thanks again for your guidance on this!
The only minor annoyance is the terraform language server startup with as a console. I tried disabling "Allocate console" in the External Tools Configuration but then the language server doesn't work at all. Any tips for that one?
Hm, no idea from the top of my mind, maybe a good question for https://bugs.eclipse.org/bugs/enter_bug.cgi?product=lsp4e
Closing this one due to no further activity here since July 2021.