fix: update tags and fix module bugs, rewrite vscode-server (#42)

This commit is contained in:
Muhammad Atif Ali
2023-09-26 02:16:14 +03:00
committed by GitHub
parent f066d5422d
commit d3d9a9f135
17 changed files with 117 additions and 119 deletions

View File

@@ -4,29 +4,32 @@ description: Add a one-click button to launch JetBrains Gateway IDEs in the dash
icon: ../.icons/gateway.svg
maintainer_github: coder
verified: true
tags: [ide, jetbrains, gateway, goland, webstorm, intellij, pycharm, phpstorm, clion, rubymine, datagrip, rider]
tags: [ide, jetbrains, helper, parameter]
---
# JetBrains Gateway
This module adds a JetBrains Gateway IDEs to your Coder template.
This module adds a JetBrains Gateway Button to open any workspace with a single click.
## How to use this module
![JetBrains Gateway IDes list](../.images/jetbrains-gateway.png)
To use this module, add the following snippet to your template manifest:
## Examples
### Add GoLand and WebStorm with the default set to GoLand
```hcl
module "jetbrains_gateway" {
source = "https://registry.coder.com/modules/jetbrains-gateway"
agent_id = coder_agent.main.id
agent_name = "main"
project_directory = "/home/coder/project"
gateway_ide_product_code = ["GO","WS"] # A list of JetBrains product codes use ["ALL"] for all products
agent_id = coder_agent.example.id
agent_name = "example"
project_directory = "/home/coder/example"
jetbrains_ides = ["GO", "WS"]
default = "GO"
}
```
## Supported IDEs
The following JetBrains IDEs are supported:
This module and JetBrains Gateway support the following JetBrains IDEs:
- GoLand (`GO`)
- WebStorm (`WS`)

View File

@@ -24,23 +24,26 @@ variable "project_directory" {
description = "The directory to open in the IDE. e.g. /home/coder/project"
}
variable "gateway_ide_product_code" {
variable "default" {
type = string
description = "Default IDE"
}
variable "jetbrains_ides" {
type = list(string)
description = "The list of IDE product codes, e.g. ['GO', 'WS'] or ['ALL']"
default = ["ALL"]
description = "The list of IDE product codes."
validation {
condition = (
length(var.gateway_ide_product_code) == 1 && var.gateway_ide_product_code[0] == "ALL" ||
alltrue([
for code in var.gateway_ide_product_code : contains(["IU", "IC", "PS", "WS", "PY", "PC", "CL", "GO", "DB", "RD", "RM"], code)
for code in var.jetbrains_ides : contains(["IU", "IC", "PS", "WS", "PY", "PC", "CL", "GO", "DB", "RD", "RM"], code)
])
)
error_message = "The gateway_ide_product_code must be ['ALL'] or a list of valid product codes. https://plugins.jetbrains.com/docs/marketplace/product-codes.html"
error_message = "The jetbrains_ides must be a list of valid product codes. https://plugins.jetbrains.com/docs/marketplace/product-codes.html"
}
}
locals {
gateway_ides = {
jetbrains_ides = {
"GO" = {
icon = "/icon/goland.svg",
name = "GoLand",
@@ -105,10 +108,10 @@ data "coder_parameter" "jetbrains_ide" {
display_name = "JetBrains IDE"
icon = "/icon/gateway.svg"
mutable = true
default = local.gateway_ides["GO"].value
default = var.default != null && var.default != "" ? local.jetbrains_ides[var.default].value : null
dynamic "option" {
for_each = contains(var.gateway_ide_product_code, "ALL") ? local.gateway_ides : { for key, value in local.gateway_ides : key => value if contains(var.gateway_ide_product_code, key) }
for_each = { for key, value in local.jetbrains_ides : key => value if contains(var.jetbrains_ides, key) }
content {
icon = option.value.icon
name = option.value.name
@@ -127,3 +130,7 @@ resource "coder_app" "gateway" {
icon = data.coder_parameter.jetbrains_ide.option[index(data.coder_parameter.jetbrains_ide.option.*.value, data.coder_parameter.jetbrains_ide.value)].icon
external = true
}
output "jetbrains_ides" {
value = data.coder_parameter.jetbrains_ide.value
}