Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

feat(dap): add rust types #371

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/rust-tools.txt
Original file line number Diff line number Diff line change
@@ -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*
Expand Down
20 changes: 20 additions & 0 deletions lua/rust-tools/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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:
--
Expand Down