summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-20 00:05:15 +0100
committerw0rp <devw0rp@gmail.com>2017-08-20 00:05:15 +0100
commit7112776d1b04d2cb01a1b01c0edfa5b86ed88e99 (patch)
tree423cb978a7e7e680013dd819b2bf20721eede77d /ale_linters
parentfb0adc602e13fb9d7ee41bb1d3303fdc6bfb45f5 (diff)
downloadale-7112776d1b04d2cb01a1b01c0edfa5b86ed88e99.zip
#653 Update tslint to set the filename key for problems in other files
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/typescript/tslint.vim31
1 files changed, 16 insertions, 15 deletions
diff --git a/ale_linters/typescript/tslint.vim b/ale_linters/typescript/tslint.vim
index 4db5094f..26d26c8c 100644
--- a/ale_linters/typescript/tslint.vim
+++ b/ale_linters/typescript/tslint.vim
@@ -12,27 +12,27 @@ function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
endfunction
function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
+ let l:dir = expand('#' . a:buffer . ':p:h')
let l:output = []
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
- if ale#path#IsBufferPath(a:buffer, l:error.name)
- call add(l:output, {
- \ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
- \ 'text': has_key(l:error, 'ruleName')
- \ ? l:error.ruleName . ': ' . l:error.failure
- \ : 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,
- \})
- endif
+ call add(l:output, {
+ \ '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,
+ \ '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,
+ \})
endfor
return l:output
endfunction
-function! ale_linters#typescript#tslint#BuildLintCommand(buffer) abort
+function! ale_linters#typescript#tslint#GetCommand(buffer) abort
let l:tslint_config_path = ale#path#ResolveLocalPath(
\ a:buffer,
\ 'tslint.json',
@@ -43,7 +43,8 @@ function! ale_linters#typescript#tslint#BuildLintCommand(buffer) abort
\ ? ' -c ' . ale#Escape(l:tslint_config_path)
\ : ''
- return ale_linters#typescript#tslint#GetExecutable(a:buffer)
+ return ale#path#BufferCdString(a:buffer)
+ \ . ale_linters#typescript#tslint#GetExecutable(a:buffer)
\ . ' --format json'
\ . l:tslint_config_option
\ . ' %t'
@@ -52,6 +53,6 @@ endfunction
call ale#linter#Define('typescript', {
\ 'name': 'tslint',
\ 'executable_callback': 'ale_linters#typescript#tslint#GetExecutable',
-\ 'command_callback': 'ale_linters#typescript#tslint#BuildLintCommand',
+\ 'command_callback': 'ale_linters#typescript#tslint#GetCommand',
\ 'callback': 'ale_linters#typescript#tslint#Handle',
\})