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* 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: --