Closed skela closed 3 months ago
So far it wasn't possible - at least not without monkey patching. The only real option was to use the integrated terminal feature, which causes most debug adapters to rarely send any output events.
Given this has come up a few times I created a PR that would allow output handling customization: https://github.com/mfussenegger/nvim-dap/pull/1175
Could you try that and give some feedback?
Sure ill give it a go as soon as I can, if i can figure out how to do it ;D
I did give it a go, but i think im prob not putting it in the right place, could you give me a hint as to where im to add this on_output fn ?
I did give it a go, but i think im prob not putting it in the right place, could you give me a hint as to where im to add this on_output fn ?
This plugin doesn't take opts
like others. You need to explicitly add this option inside your config = function()
like this:
local dap = require("dap")
dap.defaults.fallback.on_output = function(session, output_event) end -- this will set the option globally (all languages)
or
dap.defaults.java.on_output = function(session, output_event) end -- this will set the option just for java
Can the on_output
callback be used to filter events? Something like:
local dap = require("dap")
dap.defaults.fallback.on_output = function(session, output_event)
if not output_event:match("Could not read source map for file") then
-- output to repl
end
end
I want to filter out these logs:
Works perfectly!
local dap = require("dap")
dap.defaults.dart.on_output = function(session, output_event) end
I was able to implement filtering like this:
local dap = require("dap")
local repl = require("dap.repl")
dap.defaults.fallback.on_output = function(session, event)
if event.category == "stdout" and not string.find(event.output, "Could not read source map for file") then
repl.append(event.output, "$", { newline = false })
end
end
Problem Statement
The console logs for Android can be a bit verbose + excessive, and will most often keep running when you are paused at a break point, rendering the repl function via dap useless. Unless yer insanely fast, you won't be able to type the thing you want to run, before the logs overwrite and clear the repl line.
Possible Solutions
I typically have the logs in a completely different terminal or app anyway, so was wondering if you could add a way to disable the logging in repl, leaving it purely for repl stuff.
I'm not suggesting making it the default, just add a config flag or something where u can disable logs in repl.
If its already possible to do this, I apologize for the noise. Have looked at the help pages, without any luck.
Considered Alternatives
No response