diff --git a/README.md b/README.md index 8c50c5f..7aa31db 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,15 @@ The format for the `lsp.server` value is a comma-separated list for each file ty =[=][,...] ``` +If you encounter an issue whereby the `lsp.server` settings configuration is auto-removed when you change any other configuration option, +you can use an environment variable called `MICRO_LSP` to define the same information. You can add a line such as the following to your shell profile (e.g. .bashrc): + +``` +export MICRO_LSP='python=pyls,go=gopls,typescript=deno lsp={"importMap":"import_map.json"},rust=rls' +``` + +The environment variable is used as a fallback if the `lsp.server` option is not defined. + Testing ------- diff --git a/main.lua b/main.lua index 65f4017..904424a 100644 --- a/main.lua +++ b/main.lua @@ -1,3 +1,5 @@ +VERSION = "0.4.1" + local micro = import("micro") local config = import("micro/config") local shell = import("micro/shell") @@ -53,7 +55,8 @@ end function startServers() local wd, _ = os.Getwd() rootUri = fmt.Sprintf("file://%s", wd) - local server = mysplit(config.GetGlobalOption("lsp.server") or '', ",") + local envFallback, _ = os.Getenv("MICRO_LSP") + local server = mysplit(config.GetGlobalOption("lsp.server") or envFallback or '', ",") for i in pairs(server) do local part = mysplit(server[i], "=") local run = mysplit(part[2], "%s") @@ -74,7 +77,7 @@ end function init() config.RegisterGlobalOption("lsp", "server", "") - config.RegisterGlobalOption("lsp", "formatOnSave", "") + config.RegisterGlobalOption("lsp", "formatOnSave", true) config.MakeCommand("hover", hoverAction, config.NoComplete) config.MakeCommand("definition", definitionAction, config.NoComplete) config.MakeCommand("lspcompletion", completionAction, config.NoComplete) diff --git a/repo.json b/repo.json index e29b017..a5d1465 100644 --- a/repo.json +++ b/repo.json @@ -1,14 +1,14 @@ [{ - "Name": "LSP", + "Name": "lsp", "Description": "Generic LSP Client for Micro", - "Website": "https://github.com/user/plugin", + "Website": "https://github.com/AndCake/micro-plugin-lsp", "Tags": ["lsp"], "Versions": [ { - "Version": "1.0.0", - "Url": "https://github.com/user/plugin/archive/v1.0.0.zip", + "Version": "0.4.1", + "Url": "https://github.com/AndCake/micro-plugin-lsp/archive/v0.4.1.zip", "Require": { - "micro": ">=1.0.3" + "micro": ">=2.0.10" } } ]