Permalink
Browse files

Report errors in jslintrc file

  • Loading branch information...
1 parent fd023a4 commit da5f0cd16a6889c86394c0e7839326a8cd6d12df @hallettj committed Feb 26, 2012
Showing with 28 additions and 24 deletions.
  1. +28 −24 ftplugin/javascript/jslint.vim
@@ -164,32 +164,36 @@ function! s:JSLint()
let l:line = b:parts[1] + (b:firstline - 1 - len(s:jslintrc)) " Get line relative to selection
let l:errorMessage = b:parts[4]
- " Store the error for an error under the cursor
- let s:matchDict = {}
- let s:matchDict['lineNum'] = l:line
- let s:matchDict['message'] = l:errorMessage
- let b:matchedlines[l:line] = s:matchDict
- if b:parts[3] == 'ERROR'
- let l:errorType = 'E'
+ if l:line < 1
+ echoerr 'error in jslintrc, line ' . b:parts[1] . ', character ' . b:parts[2] . ': ' . l:errorMessage
else
- let l:errorType = 'W'
- endif
- if g:JSLintHighlightErrorLine == 1
- let s:mID = matchadd('JSLintError', '\v%' . l:line . 'l\S.*(\S|$)')
+ " Store the error for an error under the cursor
+ let s:matchDict = {}
+ let s:matchDict['lineNum'] = l:line
+ let s:matchDict['message'] = l:errorMessage
+ let b:matchedlines[l:line] = s:matchDict
+ if b:parts[3] == 'ERROR'
+ let l:errorType = 'E'
+ else
+ let l:errorType = 'W'
+ endif
+ if g:JSLintHighlightErrorLine == 1
+ let s:mID = matchadd('JSLintError', '\v%' . l:line . 'l\S.*(\S|$)')
+ endif
+ " Add line to match list
+ call add(b:matched, s:matchDict)
+
+ " Store the error for the quickfix window
+ let l:qf_item = {}
+ let l:qf_item.bufnr = bufnr('%')
+ let l:qf_item.filename = expand('%')
+ let l:qf_item.lnum = l:line
+ let l:qf_item.text = l:errorMessage
+ let l:qf_item.type = l:errorType
+
+ " Add line to quickfix list
+ call add(b:qf_list, l:qf_item)
endif
- " Add line to match list
- call add(b:matched, s:matchDict)
-
- " Store the error for the quickfix window
- let l:qf_item = {}
- let l:qf_item.bufnr = bufnr('%')
- let l:qf_item.filename = expand('%')
- let l:qf_item.lnum = l:line
- let l:qf_item.text = l:errorMessage
- let l:qf_item.type = l:errorType
-
- " Add line to quickfix list
- call add(b:qf_list, l:qf_item)
endif
endfor

0 comments on commit da5f0cd

Please sign in to comment.