Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add VS Code instructions, sort list alphabetically #131

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 46 additions & 42 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -55,34 +68,25 @@ Make sure to read through the [example vim configuration](https://github.com/neo
inoremap <silent><expr> <c-space> 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.