overseer.nvim
overseer.nvim copied to clipboard
WIP: set task output directly into the quickfix
Still feeling out what the best API and UX would be. To use it in its current form:
Option 1
- Make sure the task you're running has an 'on_output_write_file' component (you can add it to the
default
list in setup()) - After running the task, the "open output in quickfix" action should be available. It will parse the output using the current
errorformat
and set the results into the quickfix.
Option 2
- Add the
on_output_parse_errors
component to your task - Either add the
on_result_diagnostics_quickfix
component (to automatically set the quickfix), or use the "set quickfix diagnostics" action once the task has completed.
Thank you for taking an interest. (here from reddit conversation) This does work, but it adds some extra characters in the output
For example this is the output I get when using :compiler
or its extensions
|| /home/ranjith/Software/Workspaces/openFrameworks/myrto/geomShaders/fragmentationCircles/src/ofApp.cpp: In member function ‘virtual void ofApp::setup()’:
src/ofApp.cpp|6 col 5| error: ‘ofEnaleAlphaBlending’ was not declared in this scope; did you mean ‘ofEnableAlphaBlending’?
|| 6 | ofEnaleAlphaBlending();
|| | ^~~~~~~~~~~~~~~~~~~~
And the entry works the same way any qf entry should, i.e i can press return on that line and it will take me to the file in question.
With overseer for the same task I get this
|| [01m[K/home/ranjith/Software/Workspaces/openFrameworks/myrto/geomShaders/fragmentationCircles/src/ofApp.cpp:[m[K In member function ‘[01m[Kvirtual void ofApp::setup()[m[K’:
[01m[K/home/ranjith/Software/Workspaces/openFrameworks/myrto/geomShaders/fragmentationCircles/src/ofApp.cpp|6 col 5| [m[K [01;31m[Kerror: [m[K‘[01m[KofEnaleAlphaBlending[m[K’ was not declared in this scope; did you mean ‘[01m[KofEnableAlphaBlending[m[K’?
|| 6 | [01;31m[KofEnaleAlphaBlending[m[K();
|| | [01;31m[K^~~~~~~~~~~~~~~~~~~~[m[K
|| | [32m[KofEnableAlphaBlending[m[K
Thanks for reporting back! It looks like there's some issues with the stripping of ansi escape codes. There are a lot of CLI tools that try to auto-detect if they are being run in an environment that can handle those, so that might explain the difference (the built-in neovim terminal that we're using would probably be detected as "supports ansi").
Couple of questions:
- So I can reproduce it, is this just
g++
, or are you using a different tool? - Which overseer configuration did you use for this? The
on_output_parse_errors
component oron_output_write_file
with the action?
Quick response, to your questions
- Yes I am running
g++
, technicallyGnu Make
- this config I am using is
on_output_write_file
.on_output_parse_errors
does not detect these as errors and hence fills nothing in qflist
Just tested this. For the above described use case, it works as I expected! Thank you. I will also test against other languages and update here
Okay, I've fiddled around with it and the issue was what I expected. g++
provides nice coloring and formatting if it detects that you're running in a terminal, and while we were stripping some of the ansi codes, others were getting through and messing up the parser.
I've updated and simplified a lot of the logic. Both of the options listed in the PR description should work for you now. I would still like to spend a bit of time rethinking the overall story around handling ANSI codes, as I'm not completely happy with a "best effort" sanitization, but I'm out of time. I'll come back to this when I can to try to finalize the API and output parsing decisions, and then merge the PR.
Quick update: I'm going to be off the grid for about a week. This is been in the pending status for longer than I'd like, but it's still on my todo list and I'll come back to it as soon as I'm able.
Quick update: I'm going to be off the grid for about a week. This is been in the pending status for longer than I'd like, but it's still on my todo list and I'll come back to it as soon as I'm able.
For now, I used the logic you created here to create a custom component. Does not take advantage of ANSI suggested colors like you pointed out, but it does what I need. Here Thanks for all your work
using the current errorformat
It would be great to being able to set custom errorformat
for some tasks.