Compare commits

...

9 Commits

Author SHA1 Message Date
w0rp d837169f1d
Ignore compiled files from newer versions 2019-05-08 09:52:43 +01:00
w0rp 9778a6e5b5
Merge pull request #2134 from oaue/master
javac linter: fix handling of error messages containing ':' character
2019-05-08 09:51:46 +01:00
w0rp 0927634916
Fix #2452 - Strip trailing spaces off sign text automatically 2019-04-23 15:59:05 +01:00
w0rp 711de2c1be
Fix #2415 - Mark tsserver and LSP linters inactive again 2019-04-17 18:13:22 +01:00
w0rp fa18195e34
Fix #2440 - Fix the kotlinc command when Maven and Gradle are missing 2019-04-15 13:36:28 +01:00
w0rp 0059bcd1d0
Merge pull request #2433 from belka-ew/bugfix/remove-otherproject-util-double
Remove otherproject#util#Double from d.vim
2019-04-13 12:30:04 +01:00
w0rp 9d0a55edec
Do not complain about generated _callback settings 2019-04-10 19:53:22 +01:00
w0rp 950204b133
Fix #2399 - Do not check buffers used for displaying diffs 2019-04-10 18:43:21 +01:00
w0rp bbb6e70377
#2417 - Silence errors for shortmess+=T 2019-04-10 15:40:16 +01:00
15 changed files with 97 additions and 15 deletions

2
.gitignore vendored
View File

@ -3,6 +3,8 @@
# Ignore all hidden files everywhere.
# Use `git add -f` to add hidden files.
.*
__pycache__
*.pyc
/doc/tags
/init.vim
/test/ale-info-test-file

View 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:16: error: ';' expected
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:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
let l:output = []

View File

@ -12,6 +12,8 @@ let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_fi
let s:classpath_sep = has('unix') ? ':' : ';'
function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
let l:command = ''
" exec maven/gradle only if classpath is not set
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})

View File

@ -43,6 +43,11 @@ function! ale#ShouldDoNothing(buffer) abort
return 1
endif
" Do nothing for diff buffers.
if getbufvar(a:buffer, '&diff')
return 1
endif
" Do nothing for blacklisted files.
if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0
return 1

View File

@ -25,7 +25,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
let l:cursor_position = getpos('.')
" The message is truncated and saved to the history.
setlocal shortmess+=T
silent! setlocal shortmess+=T
try
exec "norm! :echomsg l:message\n"

View File

@ -1,10 +1,6 @@
" Author: Auri <me@aurieh.me>
" Description: Functions for integrating with D linters.
function! otherproject#util#Double(x) abort
return a:x * 2
endfunction
function! ale#d#FindDUBConfig(buffer) abort
" Find a DUB configuration file in ancestor paths.
" The most DUB-specific names will be tried first.

View File

@ -39,8 +39,8 @@ function! ale#engine#MarkLinterActive(info, linter) abort
endif
endfunction
function! ale#engine#MarkLinterInactive(info, linter) abort
call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter.name')
function! ale#engine#MarkLinterInactive(info, linter_name) abort
call filter(a:info.active_linter_list, 'v:val.name isnot# a:linter_name')
endfunction
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
" 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
" a sandbox.

View File

@ -340,7 +340,7 @@ function! ale#linter#PreProcess(filetype, linter) abort
throw '`aliases` must be a List of String values'
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')
execute 'echom l:key . '' is deprecated. Use `let g:ale_ignore_2_4_warnings = 1` to disable this message.'''
endif

View File

@ -27,12 +27,15 @@ function! s:HandleLSPDiagnostics(conn_id, response) abort
let l:linter_name = s:lsp_linter_map[a:conn_id]
let l:filename = ale#path#FromURI(a:response.params.uri)
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
endif
if l:buffer <= 0
call ale#engine#MarkLinterInactive(l:info, l:linter_name)
if s:ShouldIgnore(l:buffer, l:linter_name)
return
endif
@ -50,6 +53,8 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
return
endif
call ale#engine#MarkLinterInactive(l:info, l:linter_name)
if s:ShouldIgnore(l:buffer, l:linter_name)
return
endif

View File

@ -66,7 +66,7 @@ endif
" Spaces and backslashes need to be escaped for signs.
function! s:EscapeSignText(sign_text) abort
return substitute(a:sign_text, '\\\| ', '\\\0', 'g')
return substitute(substitute(a:sign_text, ' *$', '', ''), '\\\| ', '\\\0', 'g')
endfunction
" Signs show up on the left for error markers.

View File

@ -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'))

View File

@ -44,6 +44,13 @@ Execute(The javac handler should handle cannot find symbol errors):
\ 'text': 'error: cannot find symbol: bar()',
\ '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(''), [
\ '/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();',
\ ' ^',
\ ' 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):

View File

@ -5,12 +5,15 @@ Before:
let g:ale_buffer_info = {}
unlet! g:ale_lsp_error_messages
unlet! b:ale_linters
call ale#test#SetDirectory('/testplugin/test')
After:
Restore
unlet! b:ale_linters
call ale#test#RestoreDirectory()
call ale#linter#Reset()
call ale#lsp_linter#ClearLSPData()
@ -162,6 +165,47 @@ Execute(tsserver semantic error responses should be handled correctly):
\ ],
\ 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):
call ale#lsp_linter#SetLSPLinterMap({'347': 'foobar'})
call ale#lsp_linter#HandleLSPResponse(347, {

View File

@ -42,7 +42,7 @@ Before:
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
function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort

View File

@ -35,6 +35,10 @@ After:
unlet! b:funky_command_created
unlet! b:fake_mode
if &diff is 1
let &diff = 0
endif
runtime autoload/ale/util.vim
Given foobar(An empty file):
@ -70,6 +74,11 @@ Execute(DoNothing should return 1 when an operator is pending):
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):
unlet! g:ale_filetype_blacklist
unlet! g:ale_maximum_file_size