Skip to content

Latest commit

 

History

History
209 lines (135 loc) · 5.25 KB

lsp.md

File metadata and controls

209 lines (135 loc) · 5.25 KB

Language Server Protocol

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
  • 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/inlineValue
  • 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 LPS server and displayed automatically.

diagnostics

Signature Help

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

moe-signature

Document Formatting

lspFormat in Ex mode. Format the buffer.

Folding Range

lspFold in Ex mode. All existing folds will be expande.

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

Document Link

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