Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
ruby/mri: ignore efm lines that start ...
Browse files Browse the repository at this point in the history
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 6c80fa9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion syntax_checkers/ruby/mri.vim
Expand Up @@ -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.