Skip to content

Commit f8ee483

Browse files
authored
Merge pull request #39 from gruntwork-io/feat/adding-vscode-extension
feat: Adding VS Code extension
2 parents e62199b + c3998dd commit f8ee483

22 files changed

+3762
-7
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
11
terragrunt-ls
2+
3+
# Put temporary fixtures here.
4+
tmp-fixtures
5+
6+
7+
.DS_Store
8+
*.log

docs/server-capabilities.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,28 @@ When loading a document, the server will use Terragrunt's configuration parsing
1414

1515
The server provides hover information.
1616

17-
When a user hovers over a token, the server will provide information about that token.
17+
When a Language Server client hovers over a token, the server will provide information about that token.
1818

1919
At the moment, the only hover target that is supported is local variables. When hovering over a local variable, the server will provide the evaluated value of that local.
2020

2121
## DefinitionProvider
2222

23-
The server provides the ability to go to defintions.
23+
The server provides the ability to go to definitions.
2424

25-
When a user requests to go to a definition, the server will provide the location of the definition.
25+
When a Language Server client requests to go to a definition, the server will provide the location of the definition.
2626

2727
At the moment, the only definition target that is supported is includes. When requesting to go to the definition of an include, the server will provide the location of the included file.
2828

2929
## CompletionProvider
3030

3131
The server provides completion suggestions.
3232

33-
When a user requests completions for a token, the server will provide a list of suggestions.
33+
When a Language Server client requests completions for a token, the server will provide a list of suggestions.
3434

3535
At the moment, the only completions that are supported are the names of attributes and blocks. When requesting completions for an attribute or block name, the server will provide a list of suggestions based on the current context.
36+
37+
## FormatProvider
38+
39+
The server provides the ability to format Terragrunt configuration files.
40+
41+
When a Language Server client requests formatting, the server will format the document and return the formatted document to the client.

docs/setup.md

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Setup
22

3+
## Setting up build dependencies
4+
5+
To bootstrap your development environment, the most convenient method is to [install mise](https://mise.jdx.dev/installing-mise.html).
6+
7+
After installing `mise`, you can run the following command to install all necessary build dependencies for this project:
8+
9+
```bash
10+
mise install
11+
```
12+
13+
Alternatively, you can install the relevant dependencies manually by reading the [mise.toml](../mise.toml) file, and installing the dependencies listed there.
14+
15+
## Building the Language Server
16+
317
To setup the language server in your editor, first install `terragrunt-ls` by running the following at the root of this repository:
418

519
```bash
@@ -12,7 +26,33 @@ Then follow the instructions below for your editor:
1226

1327
## Visual Studio Code
1428

15-
Coming soon!
29+
To install the Visual Studio Code extension, you can manually compile the extension locally, then install it from the `.vsix` file.
30+
31+
1. Navigate to the `vscode-extension` directory:
32+
33+
```bash
34+
cd vscode-extension
35+
```
36+
37+
2. Ensure you have vsce (Visual Studio Code Extension CLI) installed. If you don't have it, you can install it globally using npm:
38+
39+
```bash
40+
npm install -g @vscode/vsce
41+
```
42+
43+
3. Run the following command to package the extension:
44+
45+
```bash
46+
vsce package
47+
```
48+
49+
4. This will create a `.vsix` file in the `vscode-extension` directory (e.g. `terragrunt-ls-0.0.1.vsix`). You can install this file directly as a Visual Studio Code extension, like so:
50+
51+
```bash
52+
code --install-extension terragrunt-ls-0.0.1.vsix
53+
```
54+
55+
Installation from the Visual Studio Extensions Marketplace coming soon!
1656

1757
## Neovim
1858

@@ -49,8 +89,10 @@ return {
4989
}
5090
```
5191
92+
Installation from Mason coming soon!
93+
5294
## Zed
5395
54-
For now install rust, clone this repo and point to `zed-extension` directory when [installing dev extension](https://zed.dev/docs/extensions/developing-extensions#developing-an-extension-locally)
96+
For now, clone this repo and point to the `zed-extension` directory when [installing dev extension](https://zed.dev/docs/extensions/developing-extensions#developing-an-extension-locally)
5597
56-
Installing from extension page comming soon ;)
98+
Installing from extension page coming soon!

mise.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[tools]
22
go = "1.24.1"
33
golangci-lint = "1.64.6"
4+
lua = "5.4.7"
5+
node = "23.10.0"
6+
rust = "1.85.1"

vscode-extension/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
out
2+
node_modules
3+
.vscode-test
4+
*.tsbuildinfo
5+
*.vsix
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
5+
// List of extensions which should be recommended for users of this workspace.
6+
"recommendations": [
7+
"dbaeumer.vscode-eslint"
8+
]
9+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// A launch configuration that compiles the extension and then opens it inside a new window
2+
{
3+
"version": "0.2.0",
4+
"configurations": [
5+
{
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"name": "Launch Terragrunt Extension",
9+
"runtimeExecutable": "${execPath}",
10+
"args": [
11+
"--extensionDevelopmentPath=${workspaceRoot}"
12+
],
13+
"outFiles": [
14+
"${workspaceRoot}/out/**/*.js"
15+
],
16+
"autoAttachChildProcesses": true,
17+
"preLaunchTask": {
18+
"type": "npm",
19+
"script": "watch"
20+
}
21+
},
22+
// {
23+
// "name": "Language Server E2E Test",
24+
// "type": "extensionHost",
25+
// "request": "launch",
26+
// "runtimeExecutable": "${execPath}",
27+
// "args": [
28+
// "--extensionDevelopmentPath=${workspaceRoot}",
29+
// "--extensionTestsPath=${workspaceRoot}/client/out/test/index",
30+
// "${workspaceRoot}/client/testFixture"
31+
// ],
32+
// "outFiles": ["${workspaceRoot}/client/out/test/**/*.js"]
33+
// }
34+
]
35+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"editor.insertSpaces": false,
3+
"typescript.tsc.autoDetect": "off",
4+
"typescript.preferences.quoteStyle": "single",
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll.eslint": "explicit"
7+
}
8+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "compile",
7+
"group": "build",
8+
"presentation": {
9+
"panel": "dedicated",
10+
"reveal": "never"
11+
},
12+
"problemMatcher": [
13+
"$tsc"
14+
]
15+
},
16+
{
17+
"type": "npm",
18+
"script": "watch",
19+
"isBackground": true,
20+
"group": {
21+
"kind": "build",
22+
"isDefault": true
23+
},
24+
"presentation": {
25+
"panel": "dedicated",
26+
"reveal": "never"
27+
},
28+
"problemMatcher": [
29+
"$tsc-watch"
30+
]
31+
}
32+
]
33+
}

vscode-extension/.vscodeignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.vscode/**
2+
**/*.ts
3+
**/*.map
4+
.gitignore
5+
**/tsconfig.json
6+
**/tsconfig.base.json
7+
contributing.md
8+
.travis.yml
9+
client/node_modules/**
10+
!client/node_modules/vscode-jsonrpc/**
11+
!client/node_modules/vscode-languageclient/**
12+
!client/node_modules/vscode-languageserver-protocol/**
13+
!client/node_modules/vscode-languageserver-types/**
14+
!client/node_modules/{minimatch,brace-expansion,concat-map,balanced-match}/**
15+
!client/node_modules/{semver,lru-cache,yallist}/**

0 commit comments

Comments
 (0)