summaryrefslogtreecommitdiff
path: root/ale_linters/typescript
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-13 23:36:15 +0000
committerw0rp <devw0rp@gmail.com>2017-11-13 23:36:15 +0000
commit037aaae593bba96b71d89c6f9bd5f14e3846e067 (patch)
treea5e260af0f19b0fbf0212bee606151b80cbfcca6 /ale_linters/typescript
parentfea708cff33343dbeff496ba2c25ed2fe7268fed (diff)
downloadale-037aaae593bba96b71d89c6f9bd5f14e3846e067.zip
#852 - Capture error codes for TSLint
Diffstat (limited to 'ale_linters/typescript')
-rw-r--r--ale_linters/typescript/tslint.vim14
1 files changed, 9 insertions, 5 deletions
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index e366af8f..a1bfbb71 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -28,17 +28,21 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
continue
endif
- call add(l:output, {
+ let l:item = {
\ 'filename': ale#path#GetAbsPath(l:dir, l:error.name),
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
- \ 'text': has_key(l:error, 'ruleName')
- \ ? l:error.ruleName . ': ' . l:error.failure
- \ : l:error.failure,
+ \ 'text': l:error.failure,
\ 'lnum': l:error.startPosition.line + 1,
\ 'col': l:error.startPosition.character + 1,
\ 'end_lnum': l:error.endPosition.line + 1,
\ 'end_col': l:error.endPosition.character + 1,
- \})
+ \}
+
+ if has_key(l:error, 'ruleName')
+ let l:item.code = l:error.ruleName
+ endif
+
+ call add(l:output, l:item)
endfor
return l:output