From 05ce2868056632d9c1c374b52d2dc71855c30476 Mon Sep 17 00:00:00 2001 From: Jean SIMARD Date: Tue, 22 Feb 2022 22:40:59 +0100 Subject: [PATCH 1/2] Add Kakoune and Helix configuration --- manual.adoc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/manual.adoc b/manual.adoc index c631ae46..2c99f433 100644 --- a/manual.adoc +++ b/manual.adoc @@ -427,6 +427,40 @@ Then click on apply, and restart the LSP server for your rust project. 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. +=== Kakoune + +https://kakoune.org/[Kakoune] editor support LSP with the help of https://github.com/kak-lsp/kak-lsp[`kak-lsp`]. +Follow the https://github.com/kak-lsp/kak-lsp#installation[instructions] to install `kak-lsp`. +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). + +Finally, you need to configure Kakoune to talk to `kak-lsp` (see https://github.com/kak-lsp/kak-lsp#usage[Usage section]). +A basic configuration will only get you LSP but you can also activate inlay diagnostics and auto-formatting on save. +The following might help you get all of this. + +[source,txt] +---- +eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak. +hook global WinSetOption filetype=rust %{ + # Enable LSP + lsp-enable-window + + # Auto-formatting on save + hook window BufWritePre .* lsp-formatting-sync + + # Configure inlay hints (only on save) + hook window -group rust-inlay-hints BufWritePost .* rust-analyzer-inlay-hints + hook -once -always window WinSetOption filetype=.* %{ + remove-hooks window rust-inlay-hints + } +} +---- + +=== Helix + +https://docs.helix-editor.com/[Helix] editor does support LSP by default. +However, it won't install `rust-analyzer` automatically. +You can follow instructions for installing <>. + == Troubleshooting Start with looking at the rust-analyzer version. From ebca99419a0f19588082ddfb1fac71b640e2bf9a Mon Sep 17 00:00:00 2001 From: Jean SIMARD Date: Wed, 23 Feb 2022 08:46:29 +0100 Subject: [PATCH 2/2] fix: typos around Kakoune and Helix section --- manual.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manual.adoc b/manual.adoc index 2c99f433..054b85b5 100644 --- a/manual.adoc +++ b/manual.adoc @@ -429,7 +429,7 @@ https://gitlab.com/cppit/jucipp[juCi++] has built-in support for the language se === Kakoune -https://kakoune.org/[Kakoune] editor support LSP with the help of https://github.com/kak-lsp/kak-lsp[`kak-lsp`]. +https://kakoune.org/[Kakoune] supports LSP with the help of https://github.com/kak-lsp/kak-lsp[`kak-lsp`]. Follow the https://github.com/kak-lsp/kak-lsp#installation[instructions] to install `kak-lsp`. 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). @@ -457,7 +457,7 @@ hook global WinSetOption filetype=rust %{ === Helix -https://docs.helix-editor.com/[Helix] editor does support LSP by default. +https://docs.helix-editor.com/[Helix] supports LSP by default. However, it won't install `rust-analyzer` automatically. You can follow instructions for installing <>.