Skip to content

Commit

Permalink
🔖 release of v0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
AndCake committed Apr 8, 2022
1 parent 8ba84f0 commit 4d1e82e
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 20 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,31 @@ type you want to boot up a language server:
<file type>=<executable with arguments where necessary>[=<initialization options passed to 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

Expand Down
54 changes: 46 additions & 8 deletions help/lsp.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
4 changes: 2 additions & 2 deletions main.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "0.5.0"
VERSION = "0.5.1"

local micro = import("micro")
local config = import("micro/config")
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
]
}]

0 comments on commit 4d1e82e

Please sign in to comment.