summary refs log tree commit diff
path: root/pkgs/applications/editors/vscode/extensions/terraform
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/editors/vscode/extensions/terraform')
-rw-r--r--pkgs/applications/editors/vscode/extensions/terraform/default.nix20
-rw-r--r--pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch19
2 files changed, 39 insertions, 0 deletions
diff --git a/pkgs/applications/editors/vscode/extensions/terraform/default.nix b/pkgs/applications/editors/vscode/extensions/terraform/default.nix
new file mode 100644
index 00000000000..e6e094bb1cb
--- /dev/null
+++ b/pkgs/applications/editors/vscode/extensions/terraform/default.nix
@@ -0,0 +1,20 @@
+{ lib, vscode-utils, terraform-ls }:
+vscode-utils.buildVscodeMarketplaceExtension rec {
+  mktplcRef = {
+    name = "terraform";
+    publisher = "hashicorp";
+    version = "2.19.0";
+    sha256 = "sha256-k/fcEJuELz0xkwivSrP6Nxtz861BLq1wR2ZDMXVrvkY=";
+  };
+
+  patches = [ ./fix-terraform-ls.patch ];
+
+  postPatch = ''
+    substituteInPlace out/serverPath.js --replace TERRAFORM-LS-PATH ${terraform-ls}/bin/terraform-ls
+  '';
+
+  meta = with lib; {
+    license = licenses.mit;
+    maintainers = with maintainers; [ rhoriguchi ];
+  };
+}
diff --git a/pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch b/pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch
new file mode 100644
index 00000000000..e2dcd0b70aa
--- /dev/null
+++ b/pkgs/applications/editors/vscode/extensions/terraform/fix-terraform-ls.patch
@@ -0,0 +1,19 @@
+diff --git a/out/serverPath.js b/out/serverPath.js
+index fafa915..2e6d376 100644
+--- a/out/serverPath.js
++++ b/out/serverPath.js
+@@ -18,7 +18,13 @@ exports.CUSTOM_BIN_PATH_OPTION_NAME = 'languageServer.pathToBinary';
+ class ServerPath {
+     constructor(context) {
+         this.context = context;
+-        this.customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME);
++
++        const customBinPath = vscode.workspace.getConfiguration('terraform').get(exports.CUSTOM_BIN_PATH_OPTION_NAME);
++        if (!customBinPath) {
++          this.customBinPath = 'TERRAFORM-LS-PATH';
++        } else {
++            this.customBinPath = customBinPath;
++        }
+     }
+     installPath() {
+         return path.join(this.context.globalStorageUri.fsPath, INSTALL_FOLDER_NAME);