vista.vim
vista.vim copied to clipboard
Ignore ctags warning lines
Universal ctags sometimes produces warning lines (in stderr) which make vista.vim trip.
$ ctags -f- src/components/JSONSchemaModal.js master
ctags: Warning: ignoring null tag in src/components/JSONSchemaModal.js(line: 117)
CheckboxWidget src/components/JSONSchemaModal.js /^ CheckboxWidget: (props) => ($/;" M
CheckboxWidget src/components/JSONSchemaModal.js /^ CheckboxWidget: (props) => ($/;" p class:widgets
...
Actually don't merge this, this fix won't always work. Warnings (stderr) is intertwined with stdout.
Ok, so I've added a 2>/dev/null
which solves the problem on my side but are you ok with that solution?
A cleaner but more involved approach would be to run the process but capture stdout and stderr separately. stdout would then be used for tags, and warnings could be displayed to the user with stderr. What do you prefer?
https://github.com/liuchengxu/vista.vim/pull/249/commits/cce80bf960abbbb10729d65d6174ced66282e1af Why this way doesn't work? I think it's ok to ignore them silently, people normally don't care these warnings.
I don't think 2>/dev/null
exists on windows, so I prefer not using this solution.
https://github.com/liuchengxu/vista.vim/commit/cce80bf960abbbb10729d65d6174ced66282e1af doesn't work because stdout and stderr are intertwined together. So you might get a line that reads like this:
BoxedClassDestroyed src/boxctags: Warning: [message here...]ed.cc /^static void BoxedClassDestroyed(const v8::WeakCallbackInfo<GIBaseInfo> &info) {$/;" f namespace:GNodeJS typeref:typename:void file:
AFAIK vimscript doesn't offer a way to capture stderr and stdout separately. It could be done in a portable way by calling into python code, which does provide that capability. But it adds a dependency on python. We could however stay in vimscript by using the asynchronous jobstart()/job_start()
APIs of vim and neovim.
What's your opinion? Do you have a preference?
The job feature is already being used: https://github.com/liuchengxu/vista.vim/blob/6c8173a106/autoload/vista/executive/ctags.vim#L166-L218, but the output of stdout and stderr are not handled seperately currently. Vim/Neovim does support dealing with stdout/stderr accordingly, what you need to do is to handle them in the callback seperately.
Ok, I'm not sure what's the best way to proceed and reading the code is a bit more work than what I can give, do you prefer I open an issue for this and you fix it when you can? Otherwise I might get myself to fix it but I don't know when.
ping @liuchengxu
Feel free to create an issue but I'm not sure when I can get some time to fix it:(. To my knowledge using the different callback for stdout
and stderr
callback in the job should fix this.