Skip to content

Commit

Permalink
fix(dap/codelldb): redirect stdio to a temp file
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jan 31, 2024
1 parent 2adcc16 commit ada6e6b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
DAP strategy. No extra configuration needed!
- `:RustLsp testables`: Prettier selection options.

### Fixes

- DAP(`codelldb`): Redirect `stdio` to a temp file.

## [4.3.0] - 2024-01-31

### Changed
Expand Down
5 changes: 5 additions & 0 deletions lua/rustaceanvim/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ function M.start(args, verbose, callback, on_error)
local final_config = local_config ~= false and local_config or dap_config
--- @cast final_config DapClientConfig

if is_codelldb then
-- https://github.com/vadimcn/codelldb/blob/v1.9.0/MANUAL.md#stdio-redirection
final_config['stdio'] = { nil, vim.fn.tempname() }
end

if dap.adapters[final_config.type] == nil then
on_error('No adapter exists named "' .. final_config.type .. '". See ":h dap-adapter" for more information')
return
Expand Down
9 changes: 0 additions & 9 deletions lua/rustaceanvim/neotest/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
local lib = require('neotest.lib')
local nio = require('nio')
local trans = require('rustaceanvim.neotest.trans')
local async = require('neotest.async')

---@type neotest.Adapter
local NeotestAdapter = { name = 'rustaceanvim' }
Expand Down Expand Up @@ -176,14 +175,6 @@ function NeotestAdapter.build_spec(run_args)
lib.notify(strategy, vim.log.levels.ERROR)
end
---@cast strategy DapClientConfig
local types = require('rustaceanvim.types.internal')
local config = require('rustaceanvim.config.internal')
local adapter = types.evaluate(config.dap.adapter)
--- @cast adapter DapExecutableConfig | DapServerConfig
local is_codelldb = adapter.type == 'server'
if is_codelldb then
strategy['stdio'] = { nil, async.fn.tempname() }
end
---@type rustaceanvim.neotest.RunSpec
local run_spec = {
cwd = cwd,
Expand Down

0 comments on commit ada6e6b

Please sign in to comment.