summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-11 23:51:36 +0100
committerw0rp <devw0rp@gmail.com>2017-10-11 23:51:41 +0100
commit02c8793c533dccf4b2f13d998135c9b8d7a944fd (patch)
tree2b833de4d80ec14d716a44694eaafa6af38ef76a
parentbe547a0111c67473f69dec93d59cb071322b05c5 (diff)
downloadale-02c8793c533dccf4b2f13d998135c9b8d7a944fd.zip
#965 Check ale#ShouldDoNothing() less and such often, for better performance
-rw-r--r--autoload/ale/cursor.vim32
-rw-r--r--test/test_lint_error_delay.vader4
2 files changed, 8 insertions, 28 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 340432f7..f5394a43 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -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
diff --git a/test/test_lint_error_delay.vader b/test/test_lint_error_delay.vader
index 4c7f0947..7f081794 100644
--- a/test/test_lint_error_delay.vader
+++ b/test/test_lint_error_delay.vader
@@ -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()