#965 Check ale#ShouldDoNothing() less and such often, for better performance

This commit is contained in:
w0rp 2017-10-11 23:51:36 +01:00
parent be547a0111
commit 02c8793c53
2 changed files with 8 additions and 28 deletions

View File

@ -3,15 +3,6 @@
let s:cursor_timer = -1
let s:last_pos = [0, 0, 0]
let s:error_delay_ms = 1000 * 60 * 2
if !exists('s:dont_queue_until')
let s:dont_queue_until = -1
endif
if !exists('s:dont_echo_until')
let s:dont_echo_until = -1
endif
" Return a formatted message according to g:ale_echo_msg_format variable
function! s:GetMessage(linter, type, text) abort
@ -84,12 +75,12 @@ function! ale#cursor#EchoCursorWarning(...) abort
endfunction
function! s:EchoImpl() abort
if ale#ShouldDoNothing(bufnr(''))
" Only echo the warnings in normal mode, otherwise we will get problems.
if mode() isnot# 'n'
return
endif
" Only echo the warnings in normal mode, otherwise we will get problems.
if mode() isnot# 'n'
if ale#ShouldDoNothing(bufnr(''))
return
endif
@ -108,15 +99,8 @@ function! s:EchoImpl() abort
endfunction
function! ale#cursor#EchoCursorWarningWithDelay() abort
return ale#CallWithCooldown(
\ 'dont_echo_with_delay_until',
\ function('s:EchoWithDelayImpl'),
\ [],
\)
endfunction
function! s:EchoWithDelayImpl() abort
if ale#ShouldDoNothing(bufnr(''))
" Only echo the warnings in normal mode, otherwise we will get problems.
if mode() isnot# 'n'
return
endif
@ -135,12 +119,12 @@ function! s:EchoWithDelayImpl() abort
endfunction
function! ale#cursor#ShowCursorDetail() abort
if ale#ShouldDoNothing(bufnr(''))
" Only echo the warnings in normal mode, otherwise we will get problems.
if mode() isnot# 'n'
return
endif
" Only echo the warnings in normal mode, otherwise we will get problems.
if mode() isnot# 'n'
if ale#ShouldDoNothing(bufnr(''))
return
endif

View File

@ -17,10 +17,6 @@ Execute(ALE should stop linting for a while after exceptions are thrown):
AssertThrows call ale#Lint()
call ale#Lint()
Execute(ALE should stop queuing echo messages for a while after exceptions are thrown):
AssertThrows call ale#cursor#EchoCursorWarningWithDelay()
call ale#cursor#EchoCursorWarningWithDelay()
Execute(ALE should stop echoing messages for a while after exceptions are thrown):
AssertThrows call ale#cursor#EchoCursorWarning()
call ale#cursor#EchoCursorWarning()