From c0c3d65ffb82a8e4544a2da5ac3afa2870ffec2d Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 16 Apr 2023 13:50:43 +0100 Subject: [PATCH 1/2] feat(dap): add rust types Same trick as rust-lldb to add rust types so Vec, String, ..etc are pretty printed in the debugger windows --- lua/rust-tools/dap.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lua/rust-tools/dap.lua b/lua/rust-tools/dap.lua index 3aa1b95..11a9c5a 100644 --- a/lua/rust-tools/dap.lua +++ b/lua/rust-tools/dap.lua @@ -134,6 +134,26 @@ function M.start(args) args = args.executableArgs or {}, cwd = args.workspaceRoot, stopOnEntry = false, + -- Add rust types + initCommands = function() + -- Find out where to look for the pretty printer Python module + local rustc_sysroot = vim.fn.trim(vim.fn.system('rustc --print sysroot')) + + local script_import = 'command script import "' .. rustc_sysroot .. '/lib/rustlib/etc/lldb_lookup.py"' + local commands_file = rustc_sysroot .. '/lib/rustlib/etc/lldb_commands' + + local commands = {} + local file = io.open(commands_file, 'r') + if file then + for line in file:lines() do + table.insert(commands, line) + end + file:close() + end + table.insert(commands, 1, script_import) + + return commands + end, -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: -- From 6176b282bea3f13381941e351cc55022af899038 Mon Sep 17 00:00:00 2001 From: sigmaSd Date: Sun, 16 Apr 2023 12:53:55 +0000 Subject: [PATCH 2/2] Auto generate docs --- doc/rust-tools.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rust-tools.txt b/doc/rust-tools.txt index 6242870..9700cd5 100644 --- a/doc/rust-tools.txt +++ b/doc/rust-tools.txt @@ -1,4 +1,4 @@ -*rust-tools.txt* For NVIM v0.8.0 Last change: 2023 February 20 +*rust-tools.txt* For NVIM v0.8.0 Last change: 2023 April 16 ============================================================================== Table of Contents *rust-tools-table-of-contents*