LSP client for micro-editor. Note that this is a work in progress and has not yet been tested extensively – expect there to be some bugs. Please open an issue if you run into any!
https://asciinema.org/a/610761
Simply clone the repository to your micro plugins directory:
git clone https://github.com/Andriamanitra/mlsp ~/.config/micro/plug/mlsp
You will also need to install language servers for the programming languages you want to use.
The plugin currently provides following commands:
lsp deno lsp
starts a language server by executing command deno lsp
.
Without arguments the lsp
command will try to guess the right server by
looking at the currently open filetype.lsp-stop deno
stops the language server with name deno
. Without arguments
the lsp-stop
command will stop all currently running language servers.hover
shows hover information for the code under cursor.format
formats the buffer that is currently open.autocomplete
for code completion suggestions. PROTIP: If you wish to use the
same key as micro's autocompletion (tab by default), enable tabAutocomplete
in config.lua
instead of binding command:autocomplete
to a key!goto-definition
– open the definition for the symbol under cursorgoto-declaration
– open the declaration for the symbol under cursorgoto-typedefinition
– open the type definition for the symbol under cursorgoto-implementation
– open the implementation for the symbol under cursorfind-references
- find all references to the symbol under cursor (shows the results in a new pane)document-symbols
- list all symbols in the current documentdiagnostic-info
- show more information about a diagnostic on the current line (useful for multiline diagnostic messages)You can type the commands on micro command prompt or bind them to keys by adding
something like this to your bindings.json
:
{
"F7": "command:lsp",
"F8": "command:format",
"Alt-h": "command:hover",
"Alt-d": "command:goto-definition",
"Alt-r": "command:find-references"
}
config.lua
to enable)config.lua
to enable)The plugin provides a function mlsp.status
that can be used in the status line format.
Here is an example configuration (~/.config/micro/settings.json
) that uses it:
{
"statusformatl": "$(filename) $(modified)($(line),$(col)) | ft:$(opt:filetype) | µlsp:$(mlsp.status)"
}
See micro documentation and the built-in status plugin for more information on customizing the statusline.
rust-analyzer
after initialization is very slow (it can take multiple seconds).