Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quickfix errorformat doesn't work for dispatch #41

Closed
lengarvey opened this issue Jul 6, 2013 · 6 comments
Closed

quickfix errorformat doesn't work for dispatch #41

lengarvey opened this issue Jul 6, 2013 · 6 comments

Comments

@lengarvey
Copy link

:Dispatch populates quickfix but doesn't seem to apply the errorformat in the same way as simply using :cgetfile

Fake steps to reproduce

Given the following file at /tmp/fake_errors

file_one.rb:1: Fake error one
file_two.rb:2: Fake error two
file_three.rb:3: Fake error three

In Vim:

:let &errorformat = '%[ #]%#%f:%l:%m'
:Dispatch cat /tmp/fake_errors

Doesn't work.

:let &errorformat = '%[ #]%#%f:%l:%m'
:cgetfile /tmp/fake_errors

Does.

My actual problem

What I'm trying to do here is apply a custom formatter to rspec and display the errors nicely in quickfix style.

A gif demonstrating my issue

quickfix_issue

I ran the same test with only NeoBundle and vim-dispatch enabled and without any extra vimrc stuff beyond the default and I get the same results.

The rspec formatter I'm using can be found: https://github.com/lengarvey/vimrc/blob/master/config/ruby/vim_rspec2_formatter.rb it's not working yet since I can't figure out how to get this errorformat stuff applying correctly.

Steps to reproduce:

:Dispatch bundle exec rspec -r $HOME/.vim/config/ruby/vim_rspec2_formatter.rb -f VimFormatter

Observe that the quickfix window doesn't appear to have the errors linked as expected.

Expected results

:!bundle exec rspec -r $HOME/.vim/config/ruby/vim_rspec2_formatter.rb -f VimFormatter > /tmp/tmpfile
:cgetfile /tmp/tmpfile

Am I doing something obviously wrong?

@tpope
Copy link
Owner

tpope commented Jul 6, 2013

:Dispatch ignores the current 'efm' and tries to find an appropriate one by digging through compiler/*.vim. If you want to set 'efm' yourself, you need to use :Make.

@tpope tpope closed this as completed Jul 6, 2013
@lengarvey
Copy link
Author

Thanks, that seems clearer now I'm looking through the source (although my vim script isn't at all good).

What compiler should I be using for rspec then? It isn't clear from the documentation or the source which compiler :Dispatch uses for arbitrary commands.

@tpope
Copy link
Owner

tpope commented Jul 6, 2013

With the latest vim-ruby, :Dispatch rspec ... will use the rspec compiler, which should work fine.

@lengarvey
Copy link
Author

And what compiler would :Dispatch bundle exec ... use? I've got some projects that don't seem to work with just :Dispatch rspec ... also I wouldn't mind being able to use :Dispatch zeus test ... on some large projects. I realise I'm going to have to re-write some of those into :Make ..., I'm just not sure what to set my compiler to beforehand.

My understanding is that :Dispatch is a wrapper for :Make but I can't execute arbitrary commands using :Make since I don't know which compiler to select?

Thanks again.

-- Edit

It seems that if I :set makeprg=bundle then I can do stuff like :Make exec rspec and that seems to work. Would that generally be the way you'd approach this?

@tpope
Copy link
Owner

tpope commented Jul 7, 2013

Really I'd just use binstubs, but if you insist on an explicit bundle exec, you could :compiler rspec then set makeprg=bundle\ exec\ rspec. Invoke with :Make or :Make spec/foo_spec.rb.

@vedknom
Copy link

vedknom commented Apr 22, 2015

Following the documentation to add:

let g:dispatch_compilers = {
      \ 'latex': 'tex',
      \ 'bundle exec': ''}

The errorformat is applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants