Permalink
Browse files

ruby/mri: ignore efm lines that start ...

If the line a ruby error occurs on is 'too long' it will truncate the line it
displays in the error output and wrap it in `...`. This breaks %p from finding
the correct column so this patch ignores lines starting with `...`

e.g. %p working

```
ruby -w -T1 -c broken.rb
broken.rb:2: syntax error, unexpected tIDENTIFIER, expecting $end
puts sprintf "%d, %.2f, %.2f, %.2f, %d" k, v
                                         ^
```

%p not working
```
ruby -w -T1 -c broken.rb
broken.rb:2: syntax error, unexpected tIDENTIFIER, expecting $end
...tf "%d, %.2f, %.2f, %.2f, %d" k, v[:cost], v[:val], v[:carri...
...                               ^
```
  • Loading branch information...
rbrown committed Sep 25, 2012
1 parent 9331280 commit 6c80fa9d594d1e622d0c445c379821ca9225d974
Showing with 7 additions and 1 deletion.
  1. +7 −1 syntax_checkers/ruby/mri.vim
@@ -24,6 +24,12 @@ function! SyntaxCheckers_ruby_GetLocList()
"the word "possibly" in the warning
let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context'
- let errorformat .= ',%-GSyntax OK,%E%f:%l: syntax error\, %m,%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
+ " filter out lines starting with ...
+ " long lines are truncated and wrapped in ... %p then returns the wrong
+ " column offset
+ let errorformat .= ',%-G%\%.%\%.%\%.%.%#'
+
+ let errorformat .= ',%-GSyntax OK,%E%f:%l: syntax error\, %m'
+ let errorformat .= ',%Z%p^,%W%f:%l: warning: %m,%Z%p^,%W%f:%l: %m,%-C%.%#'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
endfunction

0 comments on commit 6c80fa9

Please sign in to comment.