Language Server Protocol

June 10, 2026 ยท View on GitHub

Moe supports LSP but work in progress and not recommended for use yet.

Currently, I tested Nim language server and rust-analyzer.

Please feedback, bug reports and PRs.

Supported LSP commands

  • Initialize
  • shutdown
  • exit
  • window/showMessage
  • window/logMessage
  • window/workDoneProgress/create
  • workspace/configuration
  • workspace/didChangeConfiguration
  • textDocument/publishDiagnostics
  • textDocument/didOpen
  • textDocument/didChange
  • textDocument/didSave
  • textDocument/didClose
  • textDocument/hover
  • textDocument/completion
  • textDocument/semanticTokens/full
  • workspace/semanticTokens/refresh
  • textDocument/inlayHint
  • workspace/inlayHint/refresh
  • textDocument/declaration
  • textDocument/definition
  • textDocument/typeDefinition
  • textDocument/implementation
  • textDocument/references
  • textDocument/rename
  • textDocument/prepareCallHierarchy
  • callHierarchy/incomingCalls
  • callHierarchy/outgoingCalls
  • textDocument/documentHighlight
  • textDocument/documentLink
  • documentLink/resolve
  • textDocument/codeLens
  • workspace/codeLens/refresh
  • codeLens/resolve
  • workspace/executeCommand
  • $/progress
  • $/cancelRequest
  • textDocument/foldingRange
  • textDocument/selectionRange
  • textDocument/documentSymbol
  • textDocument/signatureHelp
  • textDocument/formatting

Configuration

Please edit you configuration file.

Example

[Lsp]
enable = true

[Lsp.nim]
# File extensions
extensions = ["nim"]

# The LSP server command
command = "nimlangserver"

# The level of verbosity 
trace = "verbose"

Configure each language by adding table [Lsp.{languageId}]. If you want to add rust-analyzer,

[Lsp]
enable = true

[Lsp.nim]
extensions = ["nim"]
command = "nimlangserver"
trace = "off"

[Lsp.rust]
extensions = ["rs"]
command = "rust-analyzer"
trace = "messages"

Features

Hover

Press K on the word in Normal mode.

hover

Diagnostics

Results will be received from the LSP server and displayed automatically.

diagnostics

Auto Hover

When Lsp.Diagnostics.autoHover is enabled (default: true), diagnostic messages are automatically shown in a hover popup when the cursor moves onto a diagnostic range. The popup is dismissed when the cursor moves off the diagnostic.

You can also press K to manually show hover information, which will include both diagnostic messages and LSP hover content if available.

The delay before the auto hover popup appears can be configured with Lsp.Diagnostics.autoHoverDelay (default: 300 ms).

[Lsp.Diagnostics]
enable = true
autoHover = true
autoHoverDelay = 300

Signature Help

Ctrl-r in Normal mode. Show the signature help on the hover.

moe-signature

Document Formatting

lspformat in Command mode. Format the buffer.

Folding Range

lspfold in Command mode. Requests folding ranges from the language server and collapses them all (fold-all), including nested ranges such as a class, its methods, and their inner blocks. Open them again with zo/zR. Manual folds created with zf are preserved when running lspfold. The command does nothing if folding range is disabled in the config or unsupported by the server.

Note

Editing a line inside a collapsed fold (delete, change, paste, insert, a visual-mode edit, etc.) first reveals the fold and then edits only the targeted line or range. Unlike Vim, moe does not operate on a closed fold as a single unit (e.g. dd on a closed fold deletes one line, not the whole fold), so hidden text is never changed without being shown first. Pure yanks leave the fold closed. This applies to both LSP and manual (zf) folds.

moe

Selection Range

Ctrl-s in Normal mode. Enter Visual mode and you can repeat it.

Document Symbol

Space-o in Normal mode. You can select a symbol in the list and you can jump.

moe-symbol

Completion

The completion is still under development but available.

moe-completion

Semantic Tokens

Syntax highlighting with Semantic Tokens. Currently, only full is supported.

moe-semantictokens

Inlay Hint

Display types at the end of lines with LSP InlayHint.

moe-inlayhint

Inline Value

This is experimental feature. Not tested.

Goto Declaration

gc command in Normal mode. If the file is not currently, it will open in a new window.

Goto Definition

gd command in Normal mode. If the file is not currently, it will open in a new window.

Goto TypeDefinition

gy command in Normal mode. If the file is not currently, it will open in a new window.

Goto Implementation

gi command in Normal mode. If the file is not currently, it will open in a new window.

Find References

gr command in Normal mode. Open References mode.

moe-references

Call Hierarchy

gh command in Noemal mode. Open Call Hierarchy viewer

moe-call

Document Highlight

If this feature is enabled, Highlight.currentWord will be forced to disable.

moe-documenthighlight

gl command in Normal mode. Jump to a target.

Code Lens

Currently, Only supported in rust-analyzer.

Please set true to Lps.CodeLens.enable, Lsp.rust.rustAnalyzerRunSingle, Lsp.rust.rustAnalyzerDebugSingle.

\c command in Normal mode on A code lens line.

moe-codelens

Rename

Space-r command in Normal mode. Enter a new name in the command line.

moe-rename

Execute Command

Work in prgoress