Compare commits
9 commits
Author | SHA1 | Date | |
---|---|---|---|
|
d837169f1d | ||
|
9778a6e5b5 | ||
|
0927634916 | ||
|
711de2c1be | ||
|
fa18195e34 | ||
|
0059bcd1d0 | ||
|
9d0a55edec | ||
|
950204b133 | ||
|
bbb6e70377 |
15 changed files with 97 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,6 +3,8 @@
|
||||||
# Ignore all hidden files everywhere.
|
# Ignore all hidden files everywhere.
|
||||||
# Use `git add -f` to add hidden files.
|
# Use `git add -f` to add hidden files.
|
||||||
.*
|
.*
|
||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
/doc/tags
|
/doc/tags
|
||||||
/init.vim
|
/init.vim
|
||||||
/test/ale-info-test-file
|
/test/ale-info-test-file
|
||||||
|
|
|
@ -99,7 +99,7 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
||||||
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
|
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
|
||||||
" Main.java:16: error: ';' expected
|
" Main.java:16: error: ';' expected
|
||||||
let l:directory = expand('#' . a:buffer . ':p:h')
|
let l:directory = expand('#' . a:buffer . ':p:h')
|
||||||
let l:pattern = '\v^(.*):(\d+): (.+):(.+)$'
|
let l:pattern = '\v^(.*):(\d+): (.{-1,}):(.+)$'
|
||||||
let l:col_pattern = '\v^(\s*\^)$'
|
let l:col_pattern = '\v^(\s*\^)$'
|
||||||
let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
|
let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
|
@ -12,6 +12,8 @@ let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_fi
|
||||||
let s:classpath_sep = has('unix') ? ':' : ';'
|
let s:classpath_sep = has('unix') ? ':' : ';'
|
||||||
|
|
||||||
function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
|
function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
|
||||||
|
let l:command = ''
|
||||||
|
|
||||||
" exec maven/gradle only if classpath is not set
|
" exec maven/gradle only if classpath is not set
|
||||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
||||||
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})
|
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})
|
||||||
|
|
|
@ -43,6 +43,11 @@ function! ale#ShouldDoNothing(buffer) abort
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Do nothing for diff buffers.
|
||||||
|
if getbufvar(a:buffer, '&diff')
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
" Do nothing for blacklisted files.
|
" Do nothing for blacklisted files.
|
||||||
if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0
|
if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -25,7 +25,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
|
||||||
let l:cursor_position = getpos('.')
|
let l:cursor_position = getpos('.')
|
||||||
|
|
||||||
" The message is truncated and saved to the history.
|
" The message is truncated and saved to the history.
|
||||||
setlocal shortmess+=T
|
silent! setlocal shortmess+=T
|
||||||
|
|
||||||
try
|
try
|
||||||
exec "norm! :echomsg l:message\n"
|
exec "norm! :echomsg l:message\n"
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
" Author: Auri <me@aurieh.me>
|
" Author: Auri <me@aurieh.me>
|
||||||
" Description: Functions for integrating with D linters.
|
" Description: Functions for integrating with D linters.
|
||||||
|
|
||||||
function! otherproject#util#Double(x) abort
|
|
||||||
return a:x * 2
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale#d#FindDUBConfig(buffer) abort
|
function! ale#d#FindDUBConfig(buffer) abort
|
||||||
" Find a DUB configuration file in ancestor paths.
|
" Find a DUB configuration file in ancestor paths.
|
||||||
" The most DUB-specific names will be tried first.
|
" The most DUB-specific names will be tried first.
|
||||||
|
|
|
@ -39,8 +39,8 @@ function! ale#engine#MarkLinterActive(info, linter) abort
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#engine#MarkLinterInactive(info, linter) abort
|
function! ale#engine#MarkLinterInactive(info, linter_name) abort
|
||||||
call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter.name')
|
call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter_name')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale#engine#ResetExecutableCache() abort
|
function! ale#engine#ResetExecutableCache() abort
|
||||||
|
@ -195,7 +195,7 @@ function! s:HandleExit(job_info, buffer, output, data) abort
|
||||||
let l:next_chain_index = a:job_info.next_chain_index
|
let l:next_chain_index = a:job_info.next_chain_index
|
||||||
|
|
||||||
" Remove this job from the list.
|
" Remove this job from the list.
|
||||||
call ale#engine#MarkLinterInactive(l:buffer_info, l:linter)
|
call ale#engine#MarkLinterInactive(l:buffer_info, l:linter.name)
|
||||||
|
|
||||||
" Stop here if we land in the handle for a job completing if we're in
|
" Stop here if we land in the handle for a job completing if we're in
|
||||||
" a sandbox.
|
" a sandbox.
|
||||||
|
|
|
@ -340,7 +340,7 @@ function! ale#linter#PreProcess(filetype, linter) abort
|
||||||
throw '`aliases` must be a List of String values'
|
throw '`aliases` must be a List of String values'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
for l:key in filter(keys(l:obj), 'v:val[-9:] is# ''_callback'' || v:val is# ''command_chain''')
|
for l:key in filter(keys(a:linter), 'v:val[-9:] is# ''_callback'' || v:val is# ''command_chain''')
|
||||||
if !get(g:, 'ale_ignore_2_4_warnings')
|
if !get(g:, 'ale_ignore_2_4_warnings')
|
||||||
execute 'echom l:key . '' is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
|
execute 'echom l:key . '' is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -27,12 +27,15 @@ function! s:HandleLSPDiagnostics(conn_id, response) abort
|
||||||
let l:linter_name = s:lsp_linter_map[a:conn_id]
|
let l:linter_name = s:lsp_linter_map[a:conn_id]
|
||||||
let l:filename = ale#path#FromURI(a:response.params.uri)
|
let l:filename = ale#path#FromURI(a:response.params.uri)
|
||||||
let l:buffer = bufnr(l:filename)
|
let l:buffer = bufnr(l:filename)
|
||||||
|
let l:info = get(g:ale_buffer_info, l:buffer, {})
|
||||||
|
|
||||||
if s:ShouldIgnore(l:buffer, l:linter_name)
|
if empty(l:info)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:buffer <= 0
|
call ale#engine#MarkLinterInactive(l:info, l:linter_name)
|
||||||
|
|
||||||
|
if s:ShouldIgnore(l:buffer, l:linter_name)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -50,6 +53,8 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
call ale#engine#MarkLinterInactive(l:info, l:linter_name)
|
||||||
|
|
||||||
if s:ShouldIgnore(l:buffer, l:linter_name)
|
if s:ShouldIgnore(l:buffer, l:linter_name)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -66,7 +66,7 @@ endif
|
||||||
|
|
||||||
" Spaces and backslashes need to be escaped for signs.
|
" Spaces and backslashes need to be escaped for signs.
|
||||||
function! s:EscapeSignText(sign_text) abort
|
function! s:EscapeSignText(sign_text) abort
|
||||||
return substitute(a:sign_text, '\\\| ', '\\\0', 'g')
|
return substitute(substitute(a:sign_text, ' *$', '', ''), '\\\| ', '\\\0', 'g')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Signs show up on the left for error markers.
|
" Signs show up on the left for error markers.
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpLinterTest('kotlin', 'kotlinc')
|
||||||
|
call ale#test#SetFilename('test.kt')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
|
Execute(The default command should be correct):
|
||||||
|
AssertLinter 'kotlinc', 'kotlinc ' . ale#Escape(expand('%:p'))
|
|
@ -44,6 +44,13 @@ Execute(The javac handler should handle cannot find symbol errors):
|
||||||
\ 'text': 'error: cannot find symbol: bar()',
|
\ 'text': 'error: cannot find symbol: bar()',
|
||||||
\ 'type': 'E',
|
\ 'type': 'E',
|
||||||
\ },
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'),
|
||||||
|
\ 'lnum': 58,
|
||||||
|
\ 'col': 19,
|
||||||
|
\ 'text': 'error: incompatible types: Bar cannot be converted to Foo',
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ },
|
||||||
\ ],
|
\ ],
|
||||||
\ ale_linters#java#javac#Handle(bufnr(''), [
|
\ ale_linters#java#javac#Handle(bufnr(''), [
|
||||||
\ '/tmp/vLPr4Q5/33/foo.java:1: error: some error',
|
\ '/tmp/vLPr4Q5/33/foo.java:1: error: some error',
|
||||||
|
@ -62,7 +69,10 @@ Execute(The javac handler should handle cannot find symbol errors):
|
||||||
\ ' this.bar();',
|
\ ' this.bar();',
|
||||||
\ ' ^',
|
\ ' ^',
|
||||||
\ ' symbol: method bar()',
|
\ ' symbol: method bar()',
|
||||||
\ '5 errors',
|
\ '/tmp/vLPr4Q5/33/foo.java:58: error: incompatible types: Bar cannot be converted to Foo',
|
||||||
|
\ ' this.setFoo(bar);',
|
||||||
|
\ ' ^',
|
||||||
|
\ '6 errors',
|
||||||
\ ])
|
\ ])
|
||||||
|
|
||||||
Execute(The javac handler should resolve files from different directories):
|
Execute(The javac handler should resolve files from different directories):
|
||||||
|
|
|
@ -5,12 +5,15 @@ Before:
|
||||||
let g:ale_buffer_info = {}
|
let g:ale_buffer_info = {}
|
||||||
|
|
||||||
unlet! g:ale_lsp_error_messages
|
unlet! g:ale_lsp_error_messages
|
||||||
|
unlet! b:ale_linters
|
||||||
|
|
||||||
call ale#test#SetDirectory('/testplugin/test')
|
call ale#test#SetDirectory('/testplugin/test')
|
||||||
|
|
||||||
After:
|
After:
|
||||||
Restore
|
Restore
|
||||||
|
|
||||||
|
unlet! b:ale_linters
|
||||||
|
|
||||||
call ale#test#RestoreDirectory()
|
call ale#test#RestoreDirectory()
|
||||||
call ale#linter#Reset()
|
call ale#linter#Reset()
|
||||||
call ale#lsp_linter#ClearLSPData()
|
call ale#lsp_linter#ClearLSPData()
|
||||||
|
@ -162,6 +165,47 @@ Execute(tsserver semantic error responses should be handled correctly):
|
||||||
\ ],
|
\ ],
|
||||||
\ ale#test#GetLoclistWithoutModule()
|
\ ale#test#GetLoclistWithoutModule()
|
||||||
|
|
||||||
|
Execute(tsserver errors should mark tsserver no longer active):
|
||||||
|
let b:ale_linters = ['tsserver']
|
||||||
|
runtime ale_linters/typescript/tsserver.vim
|
||||||
|
call ale#test#SetFilename('filename.ts')
|
||||||
|
call ale#engine#InitBufferInfo(bufnr(''))
|
||||||
|
|
||||||
|
let g:ale_buffer_info[bufnr('')].active_linter_list = ale#linter#Get('typescript')
|
||||||
|
Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list)
|
||||||
|
|
||||||
|
call ale#lsp_linter#HandleLSPResponse(1, {
|
||||||
|
\ 'seq': 0,
|
||||||
|
\ 'type': 'event',
|
||||||
|
\ 'event': 'semanticDiag',
|
||||||
|
\ 'body': {
|
||||||
|
\ 'file': g:dir . '/filename.ts',
|
||||||
|
\ 'diagnostics':[],
|
||||||
|
\ },
|
||||||
|
\})
|
||||||
|
|
||||||
|
AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list
|
||||||
|
|
||||||
|
Execute(LSP errors should mark linters no longer active):
|
||||||
|
let b:ale_linters = ['pyls']
|
||||||
|
runtime ale_linters/python/pyls.vim
|
||||||
|
call ale#test#SetFilename('filename.py')
|
||||||
|
call ale#engine#InitBufferInfo(bufnr(''))
|
||||||
|
call ale#lsp_linter#SetLSPLinterMap({1: 'pyls'})
|
||||||
|
|
||||||
|
let g:ale_buffer_info[bufnr('')].active_linter_list = ale#linter#Get('python')
|
||||||
|
Assert !empty(g:ale_buffer_info[bufnr('')].active_linter_list)
|
||||||
|
|
||||||
|
call ale#lsp_linter#HandleLSPResponse(1, {
|
||||||
|
\ 'method': 'textDocument/publishDiagnostics',
|
||||||
|
\ 'params': {
|
||||||
|
\ 'uri': ale#path#ToURI(g:dir . '/filename.py'),
|
||||||
|
\ 'diagnostics': [],
|
||||||
|
\ },
|
||||||
|
\})
|
||||||
|
|
||||||
|
AssertEqual [], g:ale_buffer_info[bufnr('')].active_linter_list
|
||||||
|
|
||||||
Execute(LSP errors should be logged in the history):
|
Execute(LSP errors should be logged in the history):
|
||||||
call ale#lsp_linter#SetLSPLinterMap({'347': 'foobar'})
|
call ale#lsp_linter#SetLSPLinterMap({'347': 'foobar'})
|
||||||
call ale#lsp_linter#HandleLSPResponse(347, {
|
call ale#lsp_linter#HandleLSPResponse(347, {
|
||||||
|
|
|
@ -42,7 +42,7 @@ Before:
|
||||||
|
|
||||||
runtime autoload/ale/engine.vim
|
runtime autoload/ale/engine.vim
|
||||||
|
|
||||||
let g:ale_buffer_info = {bufnr(''): {'loclist': []}}
|
let g:ale_buffer_info = {bufnr(''): {'loclist': [], 'active_linter_list': []}}
|
||||||
let g:ale_handle_loclist_called = 0
|
let g:ale_handle_loclist_called = 0
|
||||||
|
|
||||||
function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort
|
function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort
|
||||||
|
|
|
@ -35,6 +35,10 @@ After:
|
||||||
unlet! b:funky_command_created
|
unlet! b:funky_command_created
|
||||||
unlet! b:fake_mode
|
unlet! b:fake_mode
|
||||||
|
|
||||||
|
if &diff is 1
|
||||||
|
let &diff = 0
|
||||||
|
endif
|
||||||
|
|
||||||
runtime autoload/ale/util.vim
|
runtime autoload/ale/util.vim
|
||||||
|
|
||||||
Given foobar(An empty file):
|
Given foobar(An empty file):
|
||||||
|
@ -70,6 +74,11 @@ Execute(DoNothing should return 1 when an operator is pending):
|
||||||
|
|
||||||
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
|
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
|
||||||
|
|
||||||
|
Execute(DoNothing should return 1 for diff buffers):
|
||||||
|
let &diff = 1
|
||||||
|
|
||||||
|
AssertEqual 1, ale#ShouldDoNothing(bufnr(''))
|
||||||
|
|
||||||
Execute(The DoNothing check should work if the ALE globals aren't defined):
|
Execute(The DoNothing check should work if the ALE globals aren't defined):
|
||||||
unlet! g:ale_filetype_blacklist
|
unlet! g:ale_filetype_blacklist
|
||||||
unlet! g:ale_maximum_file_size
|
unlet! g:ale_maximum_file_size
|
||||||
|
|
Reference in a new issue