From dd97717274c47f9596e07c1a8fa4767855ad1bdb Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Thu, 2 Jan 2025 14:52:13 +0100 Subject: [PATCH] docs(vimdoc): add missing hover and codeAction docs --- doc/rustaceanvim.txt | 12 ++++++++++++ lua/rustaceanvim/init.lua | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/doc/rustaceanvim.txt b/doc/rustaceanvim.txt index 8e8eb93f..e07f8d82 100644 --- a/doc/rustaceanvim.txt +++ b/doc/rustaceanvim.txt @@ -45,7 +45,19 @@ It accepts the following subcommands: `args[]` allows you to override the executable's arguments. 'expandMacro' - Expand macros recursively. 'moveItem {up|down}' - Move items up or down. + 'codeAction' - Sometimes, rust-analyzer groups code actions by category, + which is not supported by Neovim's built-in |vim.lsp.buf.codeAction|. + This command provides a command with a UI that does. + If you set the option `vim.g.rustaceanvim.tools.code_actions.ui_select_fallback` + to `true` (defaults to `false`), it will fall back to |vim.ui.select| + if there are no grouped code actions. 'hover {actions|range}' - Hover actions, or hover over visually selected range. + You can invoke a hover action by switching to the hover window and entering `` + on the respective line, or with a keymap for the `RustHoverAction` mapping, + which accepts a `` prefix as the (1-based) index of the hover action to invoke. + + For example, if you set the keymap: `vim.keymap.set('n', 'a', 'RustHoverAction')`, + you can invoke the third hover action with `3a`. 'explainError {cycle?|current?}' - Display a hover window with explanations form the Rust error index. - If called with |cycle| or no args: Like |vim.diagnostic.goto_next|, diff --git a/lua/rustaceanvim/init.lua b/lua/rustaceanvim/init.lua index 351c6a16..222738df 100644 --- a/lua/rustaceanvim/init.lua +++ b/lua/rustaceanvim/init.lua @@ -38,7 +38,19 @@ --- `args[]` allows you to override the executable's arguments. --- 'expandMacro' - Expand macros recursively. --- 'moveItem {up|down}' - Move items up or down. +--- 'codeAction' - Sometimes, rust-analyzer groups code actions by category, +--- which is not supported by Neovim's built-in |vim.lsp.buf.codeAction|. +--- This command provides a command with a UI that does. +--- If you set the option `vim.g.rustaceanvim.tools.code_actions.ui_select_fallback` +--- to `true` (defaults to `false`), it will fall back to |vim.ui.select| +--- if there are no grouped code actions. --- 'hover {actions|range}' - Hover actions, or hover over visually selected range. +--- You can invoke a hover action by switching to the hover window and entering `` +--- on the respective line, or with a keymap for the `RustHoverAction` mapping, +--- which accepts a `` prefix as the (1-based) index of the hover action to invoke. +--- +--- For example, if you set the keymap: `vim.keymap.set('n', 'a', 'RustHoverAction')`, +--- you can invoke the third hover action with `3a`. --- 'explainError {cycle?|current?}' - Display a hover window with explanations form the Rust error index. --- - If called with |cycle| or no args: --- Like |vim.diagnostic.goto_next|,