From b657d1b6afe17a12f4b574cce2297a7cf45f749a Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Wed, 10 Aug 2022 00:28:16 -0500 Subject: [PATCH] refactor(nvim): support new breaking changes in rust-tools --- .../primary/config/after/ftplugin/rust.lua | 25 ++++---- .../config/lua/plugins/configs/lsp.lua | 57 +++++++++++++++++-- 2 files changed, 62 insertions(+), 20 deletions(-) diff --git a/dots/.nvim-environments/primary/config/after/ftplugin/rust.lua b/dots/.nvim-environments/primary/config/after/ftplugin/rust.lua index d9589815..d23d99c0 100644 --- a/dots/.nvim-environments/primary/config/after/ftplugin/rust.lua +++ b/dots/.nvim-environments/primary/config/after/ftplugin/rust.lua @@ -1,35 +1,30 @@ -vim.keymap.set('n', 'fr', ':RustRunnables', { +vim.keymap.set("n", "fr", ":RustRunnables", { buffer = true, }) -vim.keymap.set('n', 'fd', ':RustDebuggables', { +vim.keymap.set("n", "fd", ":RustDebuggables", { buffer = true, }) -vim.keymap.set('n', 'fp', ':RustParentModule', { +vim.keymap.set("n", "fp", ":RustParentModule", { buffer = true, }) -vim.keymap.set('n', 'fJ', ':RustJoinLines', { +vim.keymap.set("n", "fJ", ":RustJoinLines", { buffer = true, }) -vim.keymap.set('n', 'fh', ':RustHoverActions', { +vim.keymap.set("n", "fh", ":RustHoverActions", { buffer = true, }) -vim.keymap.set('n', 'fH', ':RustHoverRange', { +vim.keymap.set("n", "fH", ":RustHoverRange", { buffer = true, }) -vim.keymap.set('n', 'fi', ':RustToggleInlayHints', { +vim.keymap.set("n", "fm", ":RustExpandMacro", { buffer = true, }) -vim.keymap.set('n', 'fm', ':RustExpandMacro', { +vim.keymap.set("n", "fc", ":RustOpenCargo", { buffer = true, }) -vim.keymap.set('n', 'fc', ':RustOpenCargo', { +vim.keymap.set("n", "fk", ":RustMoveItemUp", { buffer = true, }) -vim.keymap.set('n', 'fk', ':RustMoveItemUp', { +vim.keymap.set("n", "fj", ":RustMoveItemDown", { buffer = true, }) -vim.keymap.set('n', 'fj', ':RustMoveItemDown', { - buffer = true, -}) - -vim.opt.foldmethod = 'syntax' diff --git a/dots/.nvim-environments/primary/config/lua/plugins/configs/lsp.lua b/dots/.nvim-environments/primary/config/lua/plugins/configs/lsp.lua index f2b70651..fc05ce57 100755 --- a/dots/.nvim-environments/primary/config/lua/plugins/configs/lsp.lua +++ b/dots/.nvim-environments/primary/config/lua/plugins/configs/lsp.lua @@ -41,13 +41,60 @@ local liblldb_path = extension_path .. "lldb/lib/liblldb.dylib" local rustopts = { server = opts, dap = { - adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path), + adapter = { + type = "executable", + command = "lldb-vscode", + name = "rt_lldb", + }, }, tools = { - hover_actions = { auto_focus = true }, - crate_graph = { - backend = "svg", - output = "Rust-Crate-Graph-" .. os.time() .. ".svg", + -- how to execute terminal commands + -- options right now: termopen / quickfix + executor = require("rust-tools/executors").termopen, + + -- callback to execute once rust-analyzer is done initializing the workspace + -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" + on_initialized = nil, + + -- These apply to the default RustSetInlayHints command + inlay_hints = { + -- automatically set inlay hints (type hints) + -- default: true + auto = true, + + -- Only show inlay hints for the current line + only_current_line = false, + + -- whether to show parameter hints with the inlay hints or not + -- default: true + show_parameter_hints = true, + + -- prefix for parameter hints + -- default: "<-" + parameter_hints_prefix = "<- ", + + -- prefix for all the other hints (type, chaining) + -- default: "=>" + other_hints_prefix = "=> ", + + -- whether to align to the lenght of the longest line in the file + max_len_align = false, + + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + + -- whether to align to the extreme right or not + right_align = false, + + -- padding from the right if right_align is true + right_align_padding = 7, + + -- The color of the hints + highlight = "Comment", + }, + + hover_actions = { + auto_focus = true, }, }, }