LSP (Language Server Protocol) plugin for Mui editor.
- Hover: Show documentation for symbol under cursor (
Kor<Space>hfor:LspHover) - Go to Definition: Jump to symbol definition (
<Space>dfor:LspDefinition) - Go to Type Definition: Jump to type definition or toggle between Ruby/RBS files (
<Space>tfor:LspTypeDefinition) - Find References: Show all references to symbol (
<Space>rfor:LspReferences) - Completion: Get code completion suggestions (
<Space>cfor:LspCompletion) - Format: Format current file with LSP server (
<Space>ffor:LspFormat) - Diagnostics: Display errors and warnings from LSP server (
:LspDiagnostics)
Pre-configured servers for Ruby:
- Solargraph - Full-featured Ruby language server
- ruby-lsp - Shopify's Ruby language server
- Kanayago - Realtime Ruby Syntax Check server
- RuboCop (LSP mode) - Ruby linter with LSP support
- TypeProf - Ruby type analysis and inference
- Steep - Ruby type checker with RBS support
Custom servers can be configured for other languages.
Add to your .muirc:
# ~/.muirc
Mui.use "mui-lsp"Or if installing from a local path:
# ~/.muirc
Mui.use "mui-lsp", path: "/path/to/mui-lsp"Important: mui-lsp does not auto-detect LSP servers. You must explicitly configure which server(s) to use in your .muirc.
Use the Mui.lsp DSL block to configure servers:
# ~/.muirc
Mui.use "mui-lsp"
Mui.lsp do
use :solargraph
endAvailable pre-configured servers:
:solargraph- Solargraph (full-featured Ruby LSP):ruby_lsp- ruby-lsp (Shopify's Ruby LSP):rubocop- RuboCop in LSP mode:kanayago- Kanayago (Japanese Ruby LSP):typeprof- TypeProf (Ruby type analysis):steep- Steep (Ruby type checker with RBS)
TypeProf requires a configuration file in your project root. Run:
typeprof --initThis creates typeprof.conf.jsonc with default settings:
TypeProf will only analyze files in the directories specified in analysis_unit_dirs. Without this configuration file, TypeProf will not track documents and type definition features will not work.
Steep requires a Steepfile in your project root. Create one with:
# Steepfile
target :lib do
signature "sig"
check "lib"
endPlace your RBS type definitions in the sig/ directory.
For other languages or custom setups, use the server method:
# ~/.muirc
Mui.use "mui-lsp"
Mui.lsp do
# TypeScript/JavaScript
server name: "typescript",
command: "typescript-language-server --stdio",
language_ids: ["typescript", "javascript"],
file_patterns: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
# Python (pyright)
server name: "pyright",
command: "pyright-langserver --stdio",
language_ids: ["python"],
file_patterns: ["**/*.py"]
endYou can enable multiple servers for different file types:
# ~/.muirc
Mui.use "mui-lsp"
Mui.lsp do
# Ruby
use :solargraph
# TypeScript/JavaScript
server name: "typescript",
command: "typescript-language-server --stdio",
language_ids: ["typescript", "javascript"],
file_patterns: ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
endLSP servers are automatically started when you open a file that matches their configured file patterns.
To manually start a server:
:LspStart solargraph
:LspStart ruby-lsp
:LspStart rubocop| Command | Description |
|---|---|
:LspStart <name> |
Start a specific LSP server |
:LspStop [name] |
Stop a server (all if no name given) |
:LspStatus |
Show running and registered servers |
:LspHover |
Show hover information |
:LspDefinition |
Go to definition |
:LspTypeDefinition |
Go to type definition |
:LspReferences |
Find all references |
:LspCompletion |
Show completion menu |
:LspDiagnostics |
Show diagnostics for current file |
:LspDiagnosticShow |
Show diagnostic at cursor in floating window |
:LspFormat |
Format current file |
:LspLog |
Show LSP server logs in a buffer |
:LspDebug |
Show debug information |
:LspOpen |
Manually notify LSP server about current file |
| Key | Mode | Description |
|---|---|---|
K |
Normal | Show hover information (in floating window) |
<Space>df |
Normal | Go to definition |
<Space>tf |
Normal | Go to type definition (Ruby: toggle .rb/.rbs) |
<Space>rf |
Normal | Find references |
<Space>hf |
Normal | Show hover information (alternative to K) |
<Space>cf |
Normal | Show completion |
<Space>ef |
Normal | Show diagnostic at cursor (in floating window) |
<Space>ff |
Normal | Format current file |
Esc |
Normal | Close floating window / picker |
When multiple definitions or references are found, a picker buffer opens. Use standard Vim navigation:
| Key | Description |
|---|---|
j/k |
Navigate up/down (native cursor movement) |
\ + Enter |
Open selected location in current window |
Ctrl+t |
Open selected location in new tab |
\q / \ + Esc |
Close picker |
mui-lsp/
lib/mui/lsp/
protocol/ # LSP protocol definitions
position.rb # Position (line, character)
range.rb # Range (start, end positions)
location.rb # Location (URI, range)
diagnostic.rb # Diagnostic (error/warning/info)
handlers/ # Response handlers
base.rb # Base handler class
hover.rb # Hover response handler
definition.rb # Definition response handler
type_definition.rb # Type definition response handler
references.rb # References response handler
diagnostics.rb # Diagnostics notification handler
completion.rb # Completion response handler
formatting.rb # Formatting response handler
json_rpc_io.rb # JSON-RPC 2.0 over stdio
request_manager.rb # Request ID and callback management
server_config.rb # Server configuration presets
client.rb # LSP client (manages server process)
text_document_sync.rb # Document synchronization
manager.rb # Multi-server manager
plugin.rb # Mui plugin integration
cd mui-lsp
bundle install
bundle exec rake test
bundle exec rubocopMIT License
{ "typeprof_version": "experimental", "rbs_dir": "sig/", "analysis_unit_dirs": ["lib"] }