Skip to content

Commit 8025b64

Browse files
committed
Add Kakoune and Helix configuration
Follow-up of rust-analyzer/rust-analyser.github.io#181 Fixes rust-analyzer/rust-analyser.github.io#180
1 parent c79ef5f commit 8025b64

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/user/manual.adoc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,40 @@ Then click on apply, and restart the LSP server for your rust project.
436436

437437
https://gitlab.com/cppit/jucipp[juCi++] has built-in support for the language server protocol, and since version 1.7.0 offers installation of both Rust and rust-analyzer when opening a Rust file.
438438

439+
=== Kakoune
440+
441+
https://kakoune.org/[Kakoune] supports LSP with the help of https://github.com/kak-lsp/kak-lsp[`kak-lsp`].
442+
Follow the https://github.com/kak-lsp/kak-lsp#installation[instructions] to install `kak-lsp`.
443+
To configure `kak-lsp`, refer to the https://github.com/kak-lsp/kak-lsp#configuring-kak-lsp[configuration section] which is basically about copying the https://github.com/kak-lsp/kak-lsp/blob/master/kak-lsp.toml[configuration file] in the right place (latest versions should use `rust-analyzer` by default).
444+
445+
Finally, you need to configure Kakoune to talk to `kak-lsp` (see https://github.com/kak-lsp/kak-lsp#usage[Usage section]).
446+
A basic configuration will only get you LSP but you can also activate inlay diagnostics and auto-formatting on save.
447+
The following might help you get all of this.
448+
449+
[source,txt]
450+
----
451+
eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak.
452+
hook global WinSetOption filetype=rust %{
453+
# Enable LSP
454+
lsp-enable-window
455+
456+
# Auto-formatting on save
457+
hook window BufWritePre .* lsp-formatting-sync
458+
459+
# Configure inlay hints (only on save)
460+
hook window -group rust-inlay-hints BufWritePost .* rust-analyzer-inlay-hints
461+
hook -once -always window WinSetOption filetype=.* %{
462+
remove-hooks window rust-inlay-hints
463+
}
464+
}
465+
----
466+
467+
=== Helix
468+
469+
https://docs.helix-editor.com/[Helix] supports LSP by default.
470+
However, it won't install `rust-analyzer` automatically.
471+
You can follow instructions for installing <<rust-analyzer-language-server-binary,`rust-analyzer` binary>>.
472+
439473
== Troubleshooting
440474

441475
Start with looking at the rust-analyzer version.

0 commit comments

Comments
 (0)