diff --git a/CHANGELOG.md b/CHANGELOG.md index 7287d7c3..b78648dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Added +- `:RustLsp rebuildProcMacros` command. + ## [3.0.4] - 2023-10-25 ### Fixed - Allow `:RustLsp hover range` to accept a range. diff --git a/README.md b/README.md index bc4d1dd8..a3d21b5b 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,20 @@ for more configuration options. ![](https://github.com/mrcjkb/rustaceanvim/assets/12857160/477d9e58-74b0-42ff-87ca-2fef34d06db3) +
+ + Rebuild proc macros + + + ```vimscript + :RustLsp rebuildProcMacros + ``` + ```lua + vim.cmd.RustLsp('rebuildProcMacros') + ``` + +
+
Move Item Up/Down diff --git a/lua/rustaceanvim/commands/init.lua b/lua/rustaceanvim/commands/init.lua index 5ab8865a..6b370b15 100644 --- a/lua/rustaceanvim/commands/init.lua +++ b/lua/rustaceanvim/commands/init.lua @@ -27,6 +27,9 @@ local command_tbl = { expandMacro = function(_) require('rustaceanvim.commands.expand_macro')() end, + rebuildProcMacros = function() + require('rustaceanvim.commands.rebuild_proc_macros')() + end, externalDocs = function(_) require('rustaceanvim.commands.external_docs')() end, diff --git a/lua/rustaceanvim/commands/rebuild_proc_macros.lua b/lua/rustaceanvim/commands/rebuild_proc_macros.lua new file mode 100644 index 00000000..9dd8de9d --- /dev/null +++ b/lua/rustaceanvim/commands/rebuild_proc_macros.lua @@ -0,0 +1,18 @@ +local M = {} + +---@param err string | nil +local function handler(err, _, _) + if err then + vim.notify('Error rebuilding proc macros: ' .. err) + return + end +end + +local rl = require('rustaceanvim.rust_analyzer') + +--- Sends the request to rust-analyzer rebuild proc macros +function M.rebuild_macros() + rl.buf_request(0, 'rust-analyzer/rebuildProcMacros', nil, handler) +end + +return M.rebuild_macros