neovim-tasks
neovim-tasks copied to clipboard
Redirect input
Can't find a way to redirect input by using the configuration files. Is there a way?
I tried something like:
{
"cmake": {
"cmd": "cmake",
"dap_name": "lldb",
"target": "longest-palindrome",
"build_dir": "build",
"args": {
"configure": ["-DCMAKE_EXPORT_COMPILE_COMMANDS=1"],
"debug": ["<", "./sample-input.txt"]
},
"build_type": "Debug"
}
}
"debug": ["<", "./sample-input.txt"]
Should it be "debug": [">", "./sample-input.txt"]
?
Should it be
"debug": [">", "./sample-input.txt"]
?
That would redirect output, not input (and would also be a desirable feature!).
Ideally (imho) it should work as vscode. Although having stdin/stdout as extra parameters would also be convenient.
Oh, I see. Makes sense, but not sure if it's possible. I use Job API from plenary: https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/job.lua If it does not support it, I can't fix it. I would suggest to open issue there.
Seems that it has support for it (kind of):
https://github.com/nvim-lua/plenary.nvim/blob/master/lua/plenary/job.lua#L667C17-L667C17
This allows for sending data into stdin after job has started. (It would require for the file to be opened, read, and sent into the job)
Right, then we probably could add support for it by providing additional stdin
parameter with paths.
And just use it in this function:
https://github.com/Shatur/neovim-tasks/blob/f42b164499b6e833ac6b94993abc215fc4a0db17/lua/tasks/runner.lua#L98
I currently busy at the moment, but if you would like to play with it - PRs are welcome.