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 lspstarts a language server by executing commanddeno lsp. Without arguments thelspcommand will try to guess the right server by looking at the currently open filetype.lsp-stop denostops the language server with namedeno. Without arguments thelsp-stopcommand will stop all currently running language servers.hovershows hover information for the code under cursor.formatformats the buffer that is currently open.autocompletefor code completion suggestions. PROTIP: If you wish to use the same key as micro's autocompletion (tab by default), enabletabAutocompleteinconfig.luainstead of bindingcommand:autocompleteto 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"
}- get hover information
- show diagnostics (disabled by default, edit
config.luato enable) - autocomplete using tab (disabled by default, edit
config.luato enable) - format document
- format selection
- go to definition
- go to declaration
- go to implementation
- go to type definition
- find references
- list document symbols
- rename symbol
- code actions
- incremental document synchronization (better performance when editing large files)
- suggest a feature
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.
- The very first autocompletion with
rust-analyzerafter initialization is very slow (it can take multiple seconds).
- AndCake/micro-plugin-lsp is another LSP plugin for micro-editor.