From 6f8a2e8910b517406866ccde0126754cb46f861c Mon Sep 17 00:00:00 2001 From: Denis Tataurov Date: Sat, 8 Jul 2023 12:55:30 +0300 Subject: [PATCH 1/3] feat: Add version configuration to CredoLS and NextLS --- package.json | 22 ++++++++++++++++------ src/extension.ts | 18 ++++++++++++++---- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 54d2e47..ebe5964 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "elixir-tools.credo.enable": { "type": "boolean", "default": true, - "description": "Whether to start the Credo Language Server." + "markdownDescription": "Whether to start the _Credo Language Server_." }, "elixir-tools.credo.adapter": { "type": "string", @@ -44,17 +44,22 @@ "tcp" ], "default": "stdio", - "description": "Which adapter to use when connecting to credo-language-server" + "markdownDescription": "Which adapter to use when connecting to the _Credo Language Server_." }, "elixir-tools.credo.port": { "type": "integer", "default": 9000, - "description": "If adapter is `tcp`, use this port to connect." + "markdownDescription": "If adapter is `tcp`, use this port to connect." + }, + "elixir-tools.credo.version": { + "type": "string", + "default": "latest", + "markdownDescription": "Defines specific version of the _Credo Language Server_.\n\nThe default `latest` value dynamically gets the latest release from the Github when extension is activated." }, "elixir-tools.nextls.enable": { "type": "boolean", "default": false, - "description": "Whether to start NextLS." + "markdownDescription": "Whether to start the _NextLS_." }, "elixir-tools.nextls.adapter": { "type": "string", @@ -63,12 +68,17 @@ "tcp" ], "default": "stdio", - "description": "Which adapter to use when connecting to NextLS" + "markdownDescription": "Which adapter to use when connecting to the _NextLS_." }, "elixir-tools.nextls.port": { "type": "integer", "default": 9000, - "description": "If adapter is `tcp`, use this port to connect." + "markdownDescription": "If adapter is `tcp`, use this port to connect." + }, + "elixir-tools.nextls.version": { + "type": "string", + "default": "latest", + "markdownDescription": "Defines specific version of the _NextLS_.\n\nThe default `latest` value dynamically gets the latest release from the Github when extension is activated." } } }, diff --git a/src/extension.ts b/src/extension.ts index b71fa62..cb07032 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -39,12 +39,16 @@ async function activateCredo( switch (config.get("adapter")) { case "stdio": + let version = config.get("version"); + + if (version === "latest") { + version = await latestRelease("credo-language-server"); + } + serverOptions = { options: { env: Object.assign({}, process.env, { - ["CREDO_LSP_VERSION"]: await latestRelease( - "credo-language-server" - ), + ["CREDO_LSP_VERSION"]: version, }), }, command: context.asAbsolutePath("./bin/credo-language-server"), @@ -96,10 +100,16 @@ async function activateNextLS( switch (config.get("adapter")) { case "stdio": + let version = config.get("version"); + + if (version === "latest") { + version = await latestRelease("next-ls"); + } + serverOptions = { options: { env: Object.assign({}, process.env, { - ["NEXTLS_VERSION"]: await latestRelease("next-ls"), + ["NEXTLS_VERSION"]: version, }), }, command: context.asAbsolutePath("./bin/nextls"), From d50ceda3222d3cfa458d85ac7dbf43e19488351b Mon Sep 17 00:00:00 2001 From: Mitchell Hanberg Date: Wed, 12 Jul 2023 18:50:54 -0400 Subject: [PATCH 2/3] Apply suggestions from code review --- package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ebe5964..377c1a7 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "elixir-tools.credo.enable": { "type": "boolean", "default": true, - "markdownDescription": "Whether to start the _Credo Language Server_." + "markdownDescription": "Whether to start **Credo Language Server_**" }, "elixir-tools.credo.adapter": { "type": "string", @@ -44,7 +44,7 @@ "tcp" ], "default": "stdio", - "markdownDescription": "Which adapter to use when connecting to the _Credo Language Server_." + "markdownDescription": "Which adapter to use when connecting to **Credo Language Server**." }, "elixir-tools.credo.port": { "type": "integer", @@ -54,12 +54,12 @@ "elixir-tools.credo.version": { "type": "string", "default": "latest", - "markdownDescription": "Defines specific version of the _Credo Language Server_.\n\nThe default `latest` value dynamically gets the latest release from the Github when extension is activated." + "markdownDescription": "Specifies the version of **Credo Language Server**.\n\nDefaults to `latest`." }, "elixir-tools.nextls.enable": { "type": "boolean", "default": false, - "markdownDescription": "Whether to start the _NextLS_." + "markdownDescription": "Whether to start **Next LS**." }, "elixir-tools.nextls.adapter": { "type": "string", @@ -68,7 +68,7 @@ "tcp" ], "default": "stdio", - "markdownDescription": "Which adapter to use when connecting to the _NextLS_." + "markdownDescription": "Which adapter to use when connecting to **Next LS**." }, "elixir-tools.nextls.port": { "type": "integer", @@ -78,7 +78,7 @@ "elixir-tools.nextls.version": { "type": "string", "default": "latest", - "markdownDescription": "Defines specific version of the _NextLS_.\n\nThe default `latest` value dynamically gets the latest release from the Github when extension is activated." + "markdownDescription": "Specifies the version of **Next LS**.\n\nDefaults to `latest`." } } }, From a774997a68ec3e80390936ea75655ee97e84f49e Mon Sep 17 00:00:00 2001 From: Mitchell Hanberg Date: Wed, 12 Jul 2023 18:51:54 -0400 Subject: [PATCH 3/3] fixup! Apply suggestions from code review --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 377c1a7..31f521f 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "elixir-tools.credo.enable": { "type": "boolean", "default": true, - "markdownDescription": "Whether to start **Credo Language Server_**" + "markdownDescription": "Whether to start **Credo Language Server**" }, "elixir-tools.credo.adapter": { "type": "string",