diff --git a/package.json b/package.json index 54d2e47..31f521f 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 **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 **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": "Specifies the version of **Credo Language Server**.\n\nDefaults to `latest`." }, "elixir-tools.nextls.enable": { "type": "boolean", "default": false, - "description": "Whether to start NextLS." + "markdownDescription": "Whether to start **Next LS**." }, "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 **Next LS**." }, "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": "Specifies the version of **Next LS**.\n\nDefaults to `latest`." } } }, 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"),