mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
plugins update
This commit is contained in:
@ -93,22 +93,6 @@ endfunction
|
||||
function! s:async_info(echo, showstatus)
|
||||
let state = {'echo': a:echo}
|
||||
|
||||
function! s:complete(job, exit_status, messages) abort dict
|
||||
if a:exit_status != 0
|
||||
return
|
||||
endif
|
||||
|
||||
if &encoding != 'utf-8'
|
||||
let i = 0
|
||||
while i < len(a:messages)
|
||||
let a:messages[i] = iconv(a:messages[i], 'utf-8', &encoding)
|
||||
let i += 1
|
||||
endwhile
|
||||
endif
|
||||
|
||||
let result = s:info_filter(self.echo, join(a:messages, "\n"))
|
||||
call s:info_complete(self.echo, result)
|
||||
endfunction
|
||||
" explicitly bind complete to state so that within it, self will
|
||||
" always refer to state. See :help Partial for more information.
|
||||
let state.complete = function('s:complete', [], state)
|
||||
@ -151,6 +135,23 @@ function! s:async_info(echo, showstatus)
|
||||
call go#job#Start(cmd, opts)
|
||||
endfunction
|
||||
|
||||
function! s:complete(job, exit_status, messages) abort dict
|
||||
if a:exit_status != 0
|
||||
return
|
||||
endif
|
||||
|
||||
if &encoding != 'utf-8'
|
||||
let i = 0
|
||||
while i < len(a:messages)
|
||||
let a:messages[i] = iconv(a:messages[i], 'utf-8', &encoding)
|
||||
let i += 1
|
||||
endwhile
|
||||
endif
|
||||
|
||||
let result = s:info_filter(self.echo, join(a:messages, "\n"))
|
||||
call s:info_complete(self.echo, result)
|
||||
endfunction
|
||||
|
||||
function! s:gocodeFile()
|
||||
let file = tempname()
|
||||
call writefile(go#util#GetLines(), file)
|
||||
@ -241,15 +242,15 @@ function! go#complete#GocodeComplete(findstart, base) abort
|
||||
if s =~ '[(){}\{\}]'
|
||||
return map(copy(s:completions[1]), 's:trim_bracket(v:val)')
|
||||
endif
|
||||
|
||||
return s:completions[1]
|
||||
return s:completions
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! go#complete#Complete(findstart, base) abort
|
||||
let l:state = {'done': 0, 'matches': []}
|
||||
let l:state = {'done': 0, 'matches': [], 'start': -1}
|
||||
|
||||
function! s:handler(state, matches) abort dict
|
||||
function! s:handler(state, start, matches) abort dict
|
||||
let a:state.start = a:start
|
||||
let a:state.matches = a:matches
|
||||
let a:state.done = 1
|
||||
endfunction
|
||||
@ -262,15 +263,16 @@ function! go#complete#Complete(findstart, base) abort
|
||||
sleep 10m
|
||||
endwhile
|
||||
|
||||
let s:completions = l:state.matches
|
||||
|
||||
if len(l:state.matches) == 0
|
||||
" no matches. cancel and leave completion mode.
|
||||
call go#util#EchoInfo("no matches")
|
||||
return -3
|
||||
endif
|
||||
|
||||
return col('.')
|
||||
let s:completions = l:state.matches
|
||||
|
||||
return l:state.start
|
||||
|
||||
else "findstart = 0 when we need to return the list of completions
|
||||
return s:completions
|
||||
endif
|
||||
|
Reference in New Issue
Block a user