summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-05-28 20:03:35 +0100
committerw0rp <devw0rp@gmail.com>2019-05-28 20:03:35 +0100
commit67d7caee304a330cee8e1f8eb7d805da327a5b34 (patch)
tree2d2ef94db9c48146f9d2be90710f41642074fd95 /autoload
parentbc0abc3b9628103d3a75596bfabf8ba3a1a61c6d (diff)
downloadale-67d7caee304a330cee8e1f8eb7d805da327a5b34.zip
Fix #2535 - Automatically emit <C-x><C-o> less to prevent <C-o> issues
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/completion.vim31
1 files changed, 10 insertions, 21 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 9a8b76c7..9158f227 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -216,18 +216,6 @@ function! ale#completion#GetCompletionPosition() abort
endfunction
function! ale#completion#GetCompletionResult() abort
- " Parse a new response if there is one.
- if exists('b:ale_completion_response')
- \&& exists('b:ale_completion_parser')
- let l:response = b:ale_completion_response
- let l:parser = b:ale_completion_parser
-
- unlet b:ale_completion_response
- unlet b:ale_completion_parser
-
- let b:ale_completion_result = function(l:parser)(l:response)
- endif
-
if exists('b:ale_completion_result')
return b:ale_completion_result
endif
@@ -247,15 +235,20 @@ function! ale#completion#AutomaticOmniFunc(findstart, base) abort
endif
endfunction
-function! ale#completion#Show(response, completion_parser) abort
+function! ale#completion#Show(result) abort
if ale#util#Mode() isnot# 'i'
return
endif
" Set the list in the buffer, temporarily replace omnifunc with our
" function, and then start omni-completion.
- let b:ale_completion_response = a:response
- let b:ale_completion_parser = a:completion_parser
+ let b:ale_completion_result = a:result
+
+ " Don't try to open the completion menu if there's nothing to show.
+ if empty(b:ale_completion_result)
+ return
+ endif
+
" Replace completion options shortly before opening the menu.
call s:ReplaceCompletionOptions()
@@ -475,8 +468,7 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort
endif
elseif l:command is# 'completionEntryDetails'
call ale#completion#Show(
- \ a:response,
- \ 'ale#completion#ParseTSServerCompletionEntryDetails',
+ \ ale#completion#ParseTSServerCompletionEntryDetails(a:response),
\)
endif
endfunction
@@ -488,8 +480,7 @@ function! ale#completion#HandleLSPResponse(conn_id, response) abort
endif
call ale#completion#Show(
- \ a:response,
- \ 'ale#completion#ParseLSPCompletions',
+ \ ale#completion#ParseLSPCompletions(a:response),
\)
endfunction
@@ -585,8 +576,6 @@ function! ale#completion#GetCompletions(source) abort
\ 'request_id': 0,
\ 'source': a:source,
\}
- unlet! b:ale_completion_response
- unlet! b:ale_completion_parser
unlet! b:ale_completion_result
let l:buffer = bufnr('')