diff --git a/docs/USAGE.md b/docs/USAGE.md index e980b268e..23a1fe1d7 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -5,26 +5,39 @@ in the [README.md](../README.md) if that is applicable to your client (i.e. if the client doesn't download the server itself). Instructions for popular IDEs are below and pull requests -for updates or addition of more IDEs are welcomed. +for updates or addition of more IDEs are welcomed. -## Sublime Text 2 +## Emacs - - Install the [LSP package](https://github.com/sublimelsp/LSP#installation) - - Add the following snippet to your _User_ `LSP.sublime-settings` (editable via `Preferences → Package Settings → LSP → Settings` or via the command pallete → `Preferences: LSP Settings`) + - Install [lsp-mode](https://github.com/emacs-lsp/lsp-mode) + - Add the following to your `.emacs`: -```json -{ - "clients": { - "terraform": { - "command": ["terraform-ls", "serve"], - "enabled": true, - "languageId": "terraform", - "scopes": ["source.terraform"], - "syntaxes": ["Packages/Terraform/Terraform.sublime-syntax"] - } - } -} ``` +(lsp-register-client + (make-lsp-client :new-connection (lsp-stdio-connection '("/path/to/terraform-ls/terraform-ls" "serve")) + :major-modes '(terraform-mode) + :server-id 'terraform-ls)) + +(add-hook 'terraform-mode-hook #'lsp) +``` + +The last line can instead be `(add-hook 'terraform-mode-hook #'lsp-deferred)` if you prefer the server to lazy load. + +## IntelliJ IDE + + - Install [LSP Support plugin](https://plugins.jetbrains.com/plugin/10209-lsp-support) + - Open Settings + - Go to `Languages & Frameworks → Language Server Protocol → Server Definitions` + - Pick `Executable` + - set `Extension` to `tf` + - set `Path` to `terraform-ls` + - set `Args` to `serve` + - Confirm by clicking `Apply` + +Please note that the [Terraform plugin](https://plugins.jetbrains.com/plugin/7808-hashicorp-terraform--hcl-language-support) +provides overlapping functionality (and more features at the time of writing). +As a result having both enabled at the same time may result in suboptimal UX, +such as duplicate completion candidates. ## NeoVim @@ -55,34 +68,25 @@ Make sure to read through the [example vim configuration](https://github.com/neo inoremap coc#refresh() ``` -## IntelliJ IDE - - - Install [LSP Support plugin](https://plugins.jetbrains.com/plugin/10209-lsp-support) - - Open Settings - - Go to `Languages & Frameworks → Language Server Protocol → Server Definitions` - - Pick `Executable` - - set `Extension` to `tf` - - set `Path` to `terraform-ls` - - set `Args` to `serve` - - Confirm by clicking `Apply` - -Please note that the [Terraform plugin](https://plugins.jetbrains.com/plugin/7808-hashicorp-terraform--hcl-language-support) -provides overlapping functionality (and more features at the time of writing). -As a result having both enabled at the same time may result in suboptimal UX, -such as duplicate completion candidates. - -## Emacs +## Sublime Text 2 - - Install [lsp-mode](https://github.com/emacs-lsp/lsp-mode) - - Add the following to your `.emacs`: + - Install the [LSP package](https://github.com/sublimelsp/LSP#installation) + - Add the following snippet to your _User_ `LSP.sublime-settings` (editable via `Preferences → Package Settings → LSP → Settings` or via the command pallete → `Preferences: LSP Settings`) +```json +{ + "clients": { + "terraform": { + "command": ["terraform-ls", "serve"], + "enabled": true, + "languageId": "terraform", + "scopes": ["source.terraform"], + "syntaxes": ["Packages/Terraform/Terraform.sublime-syntax"] + } + } +} ``` -(lsp-register-client - (make-lsp-client :new-connection (lsp-stdio-connection '("/path/to/terraform-ls/terraform-ls" "serve")) - :major-modes '(terraform-mode) - :server-id 'terraform-ls)) -(add-hook 'terraform-mode-hook #'lsp) -``` +## VS Code -The last line can instead be `(add-hook 'terraform-mode-hook #'lsp-deferred)` if you prefer the server to lazy load. +See our [Terraform VS Code Extension](https://github.com/hashicorp/vscode-terraform) repository.