From 4d1e82e2f9b41401fa2153a195df718365fc87d7 Mon Sep 17 00:00:00 2001 From: Robert Kunze Date: Fri, 8 Apr 2022 21:39:08 +0200 Subject: [PATCH] :bookmark: release of v0.5.1 --- README.md | 19 +++++++++++-------- help/lsp.md | 54 +++++++++++++++++++++++++++++++++++++++++++++-------- main.lua | 4 ++-- repo.json | 11 +++++++++-- 4 files changed, 68 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 30e776a..6271308 100644 --- a/README.md +++ b/README.md @@ -51,28 +51,31 @@ type you want to boot up a language server: =[=][,...] ``` -You can also use an environment variable called `MICRO_LSP` to define the same information. If set, it will override the `lsp.server` from the `settings.json`. +You can also use an environment variable called `MICRO_LSP` to define the same +information. If set, it will override the `lsp.server` from the `settings.json`. 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' ``` -If neither the MICRO_LSP nor the lsp.server is set, then the plugin falls back to the following settings: +If neither the MICRO_LSP nor the lsp.server is set, then the plugin falls back +to the following settings: ``` -python=pylsp,go=gopls,typescript=deno lsp,javascript=deno lsp,rust=rls,lua=lua-lsp +python=pylsp,go=gopls,rust=rls,lua=lua-lsp,typescript=deno lsp,javascript=deno lsp,markdown=deno lsp,json=deno lsp,jsonc=deno lsp ``` ## Testing This plugin has been tested briefly with the following language servers: -- go: gopls -- typescript, javascript (including JSX/TSX): deno -- python: pyls -- rust: rls -- lua: lua-lsp +- go: [gopls](https://pkg.go.dev/golang.org/x/tools/gopls#section-readme) +- markdown, JSON, typescript, javascript (including JSX/TSX): + [deno](https://deno.land/) +- python: pyls, [pylsp](https://github.com/python-lsp/python-lsp-server) +- rust: [rls](https://github.com/rust-lang/rls) +- lua: [lua-lsp](https://github.com/Alloyed/lua-lsp) ## Known issues diff --git a/help/lsp.md b/help/lsp.md index 14a55a0..11305bf 100644 --- a/help/lsp.md +++ b/help/lsp.md @@ -10,8 +10,9 @@ This help page can be viewed in Micro editor with Ctrl-E 'help lsp' - Show function signature on status bar (alt-K) (textDocument/hover) - Open function definition in a new tab (alt-D) (textDocument/definition) - Format document (alt-F) (textDocument/formatting) -- Show references to the current symbol in a buffer (alt-R) (textDocument/references), - pressing return on the reference line, the reference's location is opened in a new tab +- Show references to the current symbol in a buffer (alt-R) + (textDocument/references), pressing return on the reference line, the + reference's location is opened in a new tab There is initial support for completion (ctrl-space) (textDocument/completion). @@ -20,17 +21,18 @@ There is initial support for completion (ctrl-space) (textDocument/completion). Installation instructions for Go and Python are provided below. LSP Plugin has been briefly tested with -- go: gopls -- typescript, javascript (including JSX/TSX): deno -- python: pyls and pylsp -- rust: rls -- lua: lua-lsp +- go: [gopls](https://pkg.go.dev/golang.org/x/tools/gopls#section-readme) +- markdown, JSON, typescript, javascript (including JSX/TSX): + [deno](https://deno.land/) +- python: pyls and [pylsp](https://github.com/python-lsp/python-lsp-server) +- rust: [rls](https://github.com/rust-lang/rls) +- lua: [lua-lsp](https://github.com/Alloyed/lua-lsp) ## Install LSP plugin $ micro --plugin install lsp -To enable LSP Plugin, you must add two lines to settings.json +To configure the LSP Plugin, you can add two lines to settings.json $ micro settings.json @@ -109,6 +111,38 @@ In this case, it's fmt/print.go. As Go reference documentation is in code comments, this is very convenient. You can navigate between tabs with atl-, (alt-comma) and alt-. (alt - full stop). To close the tab, press Ctrl-Q. +### Markdown, JSON, Typescript, Javascript + +The Deno LSP server will provide full support for Typescript and Javascript. +Additionally, it supports formatting for Markdown and JSON files. The +installation of this is fairly straight forward: + +On Mac/Linux: + + $ curl -fsSL https://deno.land/install.sh | sh + +On Powershell: + + $ iwr https://deno.land/install.ps1 -useb | iex + +### typescript-language-server + +This LSP server will allow for Javascript as well as Typescript support. For +using it, you first need to install it using NPM: + + $ npm install -g typescript-language-server typescript + +Once it has been installed, you can use it like so: + + $ micro hello.js + +Press ctrl-e and type in: + + set lsp.server "python=pylsp,go=gopls,typescript=typescript-language-server --stdio,javascript=typescript-language-server --stdio,rust=rls,lua=lua-lsp" + +After you restarted micro, you can use the features for typescript and +javascript accordingly. + ### pylsp, Python language server Installing Python language server PyLSP is a bit more involved. @@ -188,4 +222,8 @@ def square(x: int) -> int: [rls - Rust Language Server](https://github.com/rust-lang/rls) +[deno](https://deno.land/) + +[typescript-language-server](https://www.npmjs.com/package/typescript-language-server) + [lua-lsp - A Lua language server](https://github.com/Alloyed/lua-lsp) diff --git a/main.lua b/main.lua index cd36521..26a1926 100644 --- a/main.lua +++ b/main.lua @@ -1,4 +1,4 @@ -VERSION = "0.5.0" +VERSION = "0.5.1" local micro = import("micro") local config = import("micro/config") @@ -58,7 +58,7 @@ function startServers() rootUri = fmt.Sprintf("file://%s", wd) local envSettings, _ = os.Getenv("MICRO_LSP") local settings = config.GetGlobalOption("lsp.server") - local fallback = "python=pylsp,go=gopls,typescript=deno lsp,javascript=deno lsp,rust=rls,lua=lua-lsp" + local fallback = "python=pylsp,go=gopls,typescript=deno lsp,javascript=deno lsp,markdown=deno lsp,json=deno lsp,jsonc=deno lsp,rust=rls,lua=lua-lsp" if envSettings ~= nil and #envSettings > 0 then settings = envSettings end diff --git a/repo.json b/repo.json index 75775ee..db50931 100644 --- a/repo.json +++ b/repo.json @@ -26,11 +26,18 @@ } }, { - "Version": "0.5.0", + "Version": "0.5.0", "Url": "https://github.com/AndCake/micro-plugin-lsp/archive/v0.5.0.zip", "Require": { "micro": ">=2.0.8" - } + } + }, + { + "Version": "0.5.1", + "Url": "https://github.com/AndCake/micro-plugin-lsp/archive/v0.5.1.zip", + "Require": { + "micro": ">=2.0.8" + } } ] }]