Skip to content

Commit b4b902c

Browse files
committed
🔖 releases v0.4.3
1 parent 582369b commit b4b902c

File tree

4 files changed

+109
-66
lines changed

4 files changed

+109
-66
lines changed

README.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
Micro Plugin LSP Client
2-
=======================
1+
# Micro Plugin LSP Client
32

4-
**Please note:** This software is very much not finished. It is more like a proof of concept and might break if you call it names.
3+
**Please note:** This software is very much not finished. It is more like a
4+
proof of concept and might break if you call it names.
55

6-
Provides LSP methods as actions to Micro that can subsequently be mapped to key bindings.
6+
Provides LSP methods as actions to Micro that can subsequently be mapped to key
7+
bindings.
78

89
Currently implemented methods:
910

10-
* textDocument/hover
11-
* textDocument/definition
12-
* textDocument/completion
13-
* textDocument/formatting
11+
- textDocument/hover
12+
- textDocument/definition
13+
- textDocument/completion
14+
- textDocument/formatting
1415

1516
If possible, this plugin will register the following shortcuts:
1617

@@ -19,19 +20,18 @@ If possible, this plugin will register the following shortcuts:
1920
- Alt-f for formatting
2021
- Ctrl-space for completion
2122

22-
Installation
23-
------------
23+
## Installation
2424

2525
Clone this repo into micro's plug folder:
2626

2727
```
2828
$ git clone https://github.com/AndCake/micro-plugin-lsp ~/.config/micro/plug/lsp
2929
```
3030

31-
Configuration
32-
-------------
31+
## Configuration
3332

34-
In your `settings.json`, you add the `lsp.server` option in order to enable using it for your languages' server.
33+
In your `settings.json`, you add the `lsp.server` option in order to enable
34+
using it for your languages' server.
3535

3636
Example:
3737

@@ -42,33 +42,36 @@ Example:
4242
}
4343
```
4444

45-
The format for the `lsp.server` value is a comma-separated list for each file type you want to boot up a language server:
45+
The format for the `lsp.server` value is a comma-separated list for each file
46+
type you want to boot up a language server:
4647

4748
```
4849
<file type>=<executable with arguments where necessary>[=<initialization options passed to language server>][,...]
4950
```
5051

51-
If you encounter an issue whereby the `lsp.server` settings configuration is auto-removed when you change any other configuration option,
52-
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):
52+
If you encounter an issue whereby the `lsp.server` settings configuration is
53+
auto-removed when you change any other configuration option, you can use an
54+
environment variable called `MICRO_LSP` to define the same information. You can
55+
add a line such as the following to your shell profile (e.g. .bashrc):
5356

5457
```
5558
export MICRO_LSP='python=pyls,go=gopls,typescript=deno lsp={"importMap":"import_map.json"},rust=rls'
5659
```
5760

58-
The environment variable is used as a fallback if the `lsp.server` option is not defined.
61+
The environment variable is used as a fallback if the `lsp.server` option is not
62+
defined.
5963

60-
Testing
61-
-------
64+
## Testing
6265

6366
This plugin has been tested briefly with the following language servers:
6467

65-
* go: gopls
66-
* typescript, javascript (including JSX/TSX): deno
67-
* python: pyls
68-
* rust: rls
69-
* lua: lua-lsp
68+
- go: gopls
69+
- typescript, javascript (including JSX/TSX): deno
70+
- python: pyls
71+
- rust: rls
72+
- lua: lua-lsp
7073

71-
Known issues
72-
------------
74+
## Known issues
7375

74-
Not all possible types of modification events to the file are currently being sent to the language server. Saving the file will re-synchronize it, though.
76+
Not all possible types of modification events to the file are currently being
77+
sent to the language server. Saving the file will re-synchronize it, though.

help/lsp.md

Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Micro Plugin LSP Client
22

3-
LSP is a Language Server Protocol client. Features include function signatures and jump to definition.
3+
LSP is a Language Server Protocol client. Features include function signatures
4+
and jump to definition.
45

56
This help page can be viewed in Micro editor with Ctrl-E 'help lsp'
67

@@ -10,11 +11,12 @@ This help page can be viewed in Micro editor with Ctrl-E 'help lsp'
1011
- Open function definition in a new tab (alt-D) (textDocument/definition)
1112
- Format document (alt-F) (textDocument/formatting)
1213

13-
There is initial support for completion (ctrl-space) (textDocument/completion).
14+
There is initial support for completion (ctrl-space) (textDocument/completion).
1415

1516
## Supported languages
1617

17-
Installation instructions for Go and Python are provided below. LSP Plugin has been briefly tested with
18+
Installation instructions for Go and Python are provided below. LSP Plugin has
19+
been briefly tested with
1820

1921
- go: gopls
2022
- typescript, javascript (including JSX/TSX): deno
@@ -24,50 +26,56 @@ Installation instructions for Go and Python are provided below. LSP Plugin has b
2426

2527
## Install LSP plugin
2628

27-
$ micro --plugin install lsp
29+
$ micro --plugin install lsp
2830

2931
To enable LSP Plugin, you must add two lines to settings.json
3032

31-
$ micro settings.json
33+
$ micro settings.json
3234

3335
Add lines
3436

3537
```json
3638
{
37-
"lsp.server": "python=pylsp,go=gopls,typescript=deno lsp={\"importMap\": \"./import_map.json\"}",
38-
"lsp.formatOnSave": true
39+
"lsp.server": "python=pylsp,go=gopls,typescript=deno lsp={\"importMap\": \"./import_map.json\"}",
40+
"lsp.formatOnSave": true
3941
}
4042
```
4143

42-
Remember to add comma to previous line. Depending on the language server, automatic code formating can be quite opinionated. In that case, you can simply set lsp.formatOnSave to false.
44+
Remember to add comma to previous line. Depending on the language server,
45+
automatic code formating can be quite opinionated. In that case, you can simply
46+
set lsp.formatOnSave to false.
4347

44-
For Python language server, the currently maintained fork is 'pylsp'. If you wish to use the Palantir version (last updated in 2020) instead, set "python=pyls" in lsp.server.
48+
For Python language server, the currently maintained fork is 'pylsp'. If you
49+
wish to use the Palantir version (last updated in 2020) instead, set
50+
"python=pyls" in lsp.server.
4551

46-
If your lsp.server settings are autoremoved, you can
52+
If your lsp.server settings are autoremoved, you can
4753

48-
$ export MICRO_LSP='python=pylsp,go=gopls,typescript=deno lsp={"importMap":"import_map.json"},rust=rls'
54+
$ export MICRO_LSP='python=pylsp,go=gopls,typescript=deno lsp={"importMap":"import_map.json"},rust=rls'
4955

5056
## Install Language Server
5157

52-
To support each language, LSP plugin uses language servers. To use LSP plugin, you must install at least one language server.
58+
To support each language, LSP plugin uses language servers. To use LSP plugin,
59+
you must install at least one language server.
5360

54-
If you want to quickly test LSP plugin, Go language server gopls is simple to install.
61+
If you want to quickly test LSP plugin, Go language server gopls is simple to
62+
install.
5563

5664
### gopls, Go language server
5765

5866
You will need command 'gopls'
5967

60-
$ gopls version
61-
golang.org/x/tools/gopls v0.7.3
68+
$ gopls version
69+
golang.org/x/tools/gopls v0.7.3
6270

6371
In Debian, this is installed with
6472

65-
$ sudo apt-get update
66-
$ sudo apt-get -y install golang-go gopls
73+
$ sudo apt-get update
74+
$ sudo apt-get -y install golang-go gopls
6775

6876
To test it, write a short go program
6977

70-
$ micro hello.go
78+
$ micro hello.go
7179

7280
```go
7381
package main
@@ -79,58 +87,77 @@ func main() {
7987
}
8088
```
8189

82-
Move cursor over Println and press alt-k. The function signature is shown on the bottom of the screen, in Micro status bar. It shows you what parameters the function can take. The signature should look similar to this: "func fmt.Println(a ...interface{}) (n int, err error)Println formats using the default formats..."
90+
Move cursor over Println and press alt-k. The function signature is shown on the
91+
bottom of the screen, in Micro status bar. It shows you what parameters the
92+
function can take. The signature should look similar to this: "func
93+
fmt.Println(a ...interface{}) (n int, err error)Println formats using the
94+
default formats..."
8395

84-
Can you see the function signature with alt-k? If you can, you have succesfully installed Micro LSP plugin and GoPLS language server.
96+
Can you see the function signature with alt-k? If you can, you have succesfully
97+
installed Micro LSP plugin and GoPLS language server.
8598

86-
Keep your cursor over Println, and press alt-d. The file defining Println opens. 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.
99+
Keep your cursor over Println, and press alt-d. The file defining Println opens.
100+
In this case, it's fmt/print.go. As Go reference documentation is in code
101+
comments, this is very convenient. You can navigate between tabs with atl-,
102+
(alt-comma) and alt-. (alt - full stop). To close the tab, press Ctrl-Q.
87103

88104
### pylsp, Python language server
89105

90106
Installing Python language server PyLSP is a bit more involved.
91107

92-
You will need 'virtualenv' command to create virtual environments and 'pip' to install Python packages. You can also use one of the many other commands for keeping your 'pip' packages in order.
108+
You will need 'virtualenv' command to create virtual environments and 'pip' to
109+
install Python packages. You can also use one of the many other commands for
110+
keeping your 'pip' packages in order.
93111

94112
In Debian, these are installed with
95113

96-
$ sudo apt-get update
97-
$ sudo apt-get install python-pip virtualenv
114+
$ sudo apt-get update
115+
$ sudo apt-get install python-pip virtualenv
98116

99117
Create a new virtual environment
100118

101-
$ mkdir somePythonProject; cd somePythonProject
102-
$ virtualenv -p python3 env/
103-
$ source env/bin/activate
119+
$ mkdir somePythonProject; cd somePythonProject
120+
$ virtualenv -p python3 env/
121+
$ source env/bin/activate
104122

105-
Your prompt likely shows "(env)" to confirm you're inside your virtual environment.
123+
Your prompt likely shows "(env)" to confirm you're inside your virtual
124+
environment.
106125

107-
List the packages you want installed.
126+
List the packages you want installed.
108127

109-
$ micro requirements.txt
128+
$ micro requirements.txt
110129

111-
This list is to provide the most useful suggestions. If you would like to get a lot more opinionated advice, such as adding two empty lines between functions, you could use "python-lsp-server[all]". The mypy package provides optional static type checking. requirements.txt:
130+
This list is to provide the most useful suggestions. If you would like to get a
131+
lot more opinionated advice, such as adding two empty lines between functions,
132+
you could use "python-lsp-server[all]". The mypy package provides optional
133+
static type checking. requirements.txt:
112134

113135
```
114136
python-lsp-server[rope,pyflakes,mccabe,pylsp-mypy]
115137
pylsp-mypy
116138
```
117139

118-
And actually install
140+
And actually install
119141

120-
$ pip install -r requirements.txt
142+
$ pip install -r requirements.txt
121143

122144
No you can test your Python environment
123145

124-
$ micro hello.py
146+
$ micro hello.py
125147

126148
```python
127149
def helloWorld():
128150
return a
129151
```
130152

131-
Save with Ctrl-S. A red warning sign ">>" lists up in the gutter, on the left side of Micro. Move cursor to the line "return a". The status bar shows the warning: "undefined name 'a'". Well done, you have now installed Python LSP support for Micro.
153+
Save with Ctrl-S. A red warning sign ">>" lists up in the gutter, on the left
154+
side of Micro. Move cursor to the line "return a". The status bar shows the
155+
warning: "undefined name 'a'". Well done, you have now installed Python LSP
156+
support for Micro.
132157

133-
MyPy provides optional static type setting. You can write normally, and type checking is ignored. You can define types for some functions, and you get automatic warnings for incorrect use of types. This is how types are marked:
158+
MyPy provides optional static type setting. You can write normally, and type
159+
checking is ignored. You can define types for some functions, and you get
160+
automatic warnings for incorrect use of types. This is how types are marked:
134161

135162
```python
136163
def square(x: int) -> int:
@@ -153,5 +180,4 @@ def square(x: int) -> int:
153180

154181
[rls - Rust Language Server](https://github.com/rust-lang/rls)
155182

156-
[lua-lsp - A Lua language server ](https://github.com/Alloyed/lua-lsp)
157-
183+
[lua-lsp - A Lua language server](https://github.com/Alloyed/lua-lsp)

main.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION = "0.4.1"
1+
VERSION = "0.4.3"
22

33
local micro = import("micro")
44
local config = import("micro/config")

repo.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
{
88
"Version": "0.4.1",
99
"Url": "https://github.com/AndCake/micro-plugin-lsp/archive/v0.4.1.zip",
10+
"Require": {
11+
"micro": ">=2.0.10"
12+
}
13+
},
14+
{
15+
"Version": "0.4.2",
16+
"Url": "https://github.com/AndCake/micro-plugin-lsp/archive/v0.4.2.zip",
17+
"Require": {
18+
"micro": ">=2.0.8"
19+
}
20+
},
21+
{
22+
"Version": "0.4.3",
23+
"Url": "https://github.com/AndCake/micro-plugin-lsp/archive/v0.4.3.zip",
1024
"Require": {
1125
"micro": ">=2.0.8"
1226
}

0 commit comments

Comments
 (0)