1
0
mirror of https://github.com/amix/vimrc synced 2025-07-31 17:55:00 +08:00

Updated plugins

This commit is contained in:
Amir Salihefendic
2018-08-25 18:13:42 +02:00
parent 587a185a98
commit 6bd9eda8c3
169 changed files with 2625 additions and 2334 deletions

View File

@ -5,10 +5,28 @@ IMPROVEMENTS:
[[GH-1864]](https://github.com/fatih/vim-go/pull/1864)
* Document Vim and Neovim requirements in README.md and help file.
[[GH-1889]](https://github.com/fatih/vim-go/pull/1889)
* Highlight `context.Context` when `g:go_highlight_extra_types` is set.
[[GH-1903]](https://github.com/fatih/vim-go/pull/1903)
* Run gometalinter asynchronously in Neovim.
[[GH-1901]](https://github.com/fatih/vim-go/pull/1901)
* Run gorename asynchronously in Vim8 and Neovim.
[[GH-1894]](https://github.com/fatih/vim-go/pull/1894)
* Install keyify from its canonical import path.
[[GH-1924]](https://github.com/fatih/vim-go/pull/1924)
BUG FIXES:
* Fix `:GoRun %` on Windows.
[[GH-1900]](github.com/fatih/vim-go/pull/1900)
[[GH-1900]](https://github.com/fatih/vim-go/pull/1900)
* Fix `go#complete#GetInfo()` to return a description of the identifier.
[[GH-1905]](https://github.com/fatih/vim-go/pull/1905)
* Restore support for running tests in the Neovim terminal.
[[GH-1895]](https://github.com/fatih/vim-go/pull/1895)
* Fix `:GoInfo` when `g:go_info_mode` is `gocode`
[[GH-1915]](https://github.com/fatih/vim-go/pull/1915)
BACKWARDS INCOMPATIBILITIES:
* Bump minimum required version of Vim to 7.4.2009.
[[GH-1899]](https://github.com/fatih/vim-go/pull/1899)
## 1.18 - (July 18, 2018)

View File

@ -33,7 +33,7 @@ This plugin adds Go language support for Vim, with the following main features:
## Install
vim-go requires at least Vim 7.4.1689 or Neovim 0.2.2.
vim-go requires at least Vim 7.4.2009 or Neovim 0.2.2.
The [**latest stable release**](https://github.com/fatih/vim-go/releases/latest) is the
recommended version to use. If you choose to use the master branch instead,

View File

@ -81,15 +81,15 @@ function! go#complete#GetInfo() abort
return s:sync_info(0)
endfunction
function! go#complete#Info(auto) abort
function! go#complete#Info() abort
if go#util#has_job(1)
return s:async_info(a:auto)
return s:async_info(1)
else
return s:sync_info(a:auto)
return s:sync_info(1)
endif
endfunction
function! s:async_info(auto)
function! s:async_info(echo)
if exists("s:async_info_job")
call job_stop(s:async_info_job)
unlet s:async_info_job
@ -100,7 +100,7 @@ function! s:async_info(auto)
\ 'exit_status': 0,
\ 'closed': 0,
\ 'messages': [],
\ 'auto': a:auto
\ 'echo': a:echo
\ }
function! s:callback(chan, msg) dict
@ -132,8 +132,8 @@ function! s:async_info(auto)
return
endif
let result = s:info_filter(self.auto, join(self.messages, "\n"))
call s:info_complete(self.auto, result)
let result = s:info_filter(self.echo, join(self.messages, "\n"))
call s:info_complete(self.echo, result)
endfunction
" add 1 to the offset, so that the position at the cursor will be included
@ -171,9 +171,7 @@ function! s:gocodeFile()
return file
endfunction
function! s:sync_info(auto)
" auto is true if we were called by g:go_auto_type_info's autocmd
function! s:sync_info(echo)
" add 1 to the offset, so that the position at the cursor will be included
" in gocode's search
let offset = go#util#OffsetCursor()+1
@ -182,11 +180,11 @@ function! s:sync_info(auto)
\ [expand('%:p'), offset],
\ go#util#GetLines())
let result = s:info_filter(a:auto, result)
call s:info_complete(a:auto, result)
let result = s:info_filter(a:echo, result)
return s:info_complete(a:echo, result)
endfunction
function! s:info_filter(auto, result) abort
function! s:info_filter(echo, result) abort
if empty(a:result)
return ""
endif
@ -200,7 +198,7 @@ function! s:info_filter(auto, result) abort
if len(l:candidates) == 1
" When gocode panics in vim mode, it returns
" [0, [{'word': 'PANIC', 'abbr': 'PANIC PANIC PANIC', 'info': 'PANIC PANIC PANIC'}]]
if a:auto && l:candidates[0].info ==# "PANIC PANIC PANIC"
if a:echo && l:candidates[0].info ==# "PANIC PANIC PANIC"
return ""
endif
@ -220,10 +218,12 @@ function! s:info_filter(auto, result) abort
return l:filtered[0].info
endfunction
function! s:info_complete(auto, result) abort
if !empty(a:result)
function! s:info_complete(echo, result) abort
if a:echo && !empty(a:result)
echo "vim-go: " | echohl Function | echon a:result | echohl None
endif
return a:result
endfunction
function! s:trim_bracket(val) abort

View File

@ -42,10 +42,11 @@ function! go#def#Jump(mode) abort
call extend(cmd, ["definition", fname . ':#' . go#util#OffsetCursor()])
if go#util#has_job()
if go#util#has_job() || has('nvim')
let l:spawn_args = {
\ 'cmd': cmd,
\ 'complete': function('s:jump_to_declaration_cb', [a:mode, bin_name]),
\ 'for': '_',
\ }
if &modified

View File

@ -34,4 +34,33 @@ func! Test_jump_to_declaration_godef() abort
endtry
endfunc
func! Test_Jump_leaves_lists() abort
try
let filename = 'def/jump.go'
let l:tmp = gotest#load_fixture(l:filename)
let expected = [{'lnum': 10, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'quux'}]
call setloclist(winnr(), copy(expected), 'r' )
call setqflist(copy(expected), 'r' )
let l:bufnr = bufnr('%')
call cursor(6, 3)
call go#def#Jump('')
let start = reltime()
while bufnr('%') == l:bufnr && reltimefloat(reltime(start)) < 10
sleep 100m
endwhile
let actual = getloclist(winnr())
call gotest#assert_quickfix(actual, expected)
let actual = getqflist()
call gotest#assert_quickfix(actual, expected)
finally
call delete(l:tmp, 'rf')
endtry
endfunc
" vim: sw=2 ts=2 et

View File

@ -14,8 +14,6 @@ endfunction
" logic.
"
" args is a dictionary with the these keys:
" 'cmd':
" The value to pass to job_start().
" 'bang':
" Set to 0 to jump to the first error in the error list.
" Defaults to 0.
@ -24,6 +22,7 @@ endfunction
" See statusline.vim.
" 'for':
" The g:go_list_type_command key to use to get the error list type to use.
" Errors will not be handled when the value is '_'.
" Defaults to '_job'
" 'errorformat':
" The errorformat string to use when parsing errors. Defaults to
@ -32,9 +31,9 @@ endfunction
" 'complete':
" A function to call after the job exits and the channel is closed. The
" function will be passed three arguments: the job, its exit code, and the
" list of messages received from the channel. The default value will
" process the messages and manage the error list after the job exits and
" the channel is closed.
" list of messages received from the channel. The default is a no-op. A
" custom value can modify the messages before they are processed by the
" returned exit_cb and close_cb callbacks.
" The return value is a dictionary with these keys:
" 'callback':
@ -47,7 +46,9 @@ endfunction
" A function suitable to be passed as a job close_cb handler. See
" job-close_cb.
" 'cwd':
" The path to the directory which contains the current buffer.
" The path to the directory which contains the current buffer. The
" callbacks are configured to expect this directory is the working
" directory for the job; it should not be modified by callers.
function! go#job#Options(args)
let cbs = {}
let state = {
@ -184,7 +185,15 @@ function! go#job#Options(args)
let cbs.close_cb = function('s:close_cb', [], state)
function state.show_errors(job, exit_status, data)
if self.for == '_'
return
endif
let l:winid = win_getid(winnr())
" Always set the active window to the window that was active when the job
" was started. Among other things, this makes sure that the correct
" window's location list will be populated when the list type is
" 'location' and the user has moved windows since starting the job.
call win_gotoid(self.winid)
let l:listtype = go#list#Type(self.for)
@ -221,6 +230,8 @@ function! go#job#Options(args)
return
endif
" only open the error window if user was still in the window from which
" the job was started.
if self.winid == l:winid
call go#list#Window(l:listtype, len(errors))
if !self.bang
@ -229,17 +240,20 @@ function! go#job#Options(args)
endif
endfunction
if has('nvim')
return s:neooptions(cbs)
endif
return cbs
endfunction
" go#job#Start runs a job. The options are expected to be the options
" suitable for Vim8 jobs. When called from Neovim, Vim8 options will be
" transformed to their Neovim equivalents.
function! go#job#Start(cmd, options)
let l:cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
let l:options = copy(a:options)
if has('nvim')
let l:options = s:neooptions(l:options)
endif
if !has_key(l:options, 'cwd')
" pre start
let dir = getcwd()
@ -249,10 +263,11 @@ function! go#job#Start(cmd, options)
if has_key(l:options, '_start')
call l:options._start()
" remove _start to play nicely with vim (when vim encounters an unexpected
" job option it reports an "E475: invalid argument" error.
" job option it reports an "E475: invalid argument" error).
unlet l:options._start
endif
if has('nvim')
let l:input = []
if has_key(l:options, 'in_io') && l:options.in_io ==# 'file' && !empty(l:options.in_name)
@ -286,6 +301,11 @@ function! s:neooptions(options)
let l:options['stderr_buf'] = ''
for key in keys(a:options)
if key == 'cwd'
let l:options['cwd'] = a:options['cwd']
continue
endif
if key == 'callback'
let l:options['callback'] = a:options['callback']
@ -402,5 +422,4 @@ function! s:neooptions(options)
return l:options
endfunction
" vim: sw=2 ts=2 et

View File

@ -41,7 +41,11 @@ function! go#lint#Gometa(autosave, ...) abort
redraw
" Include only messages for the active buffer for autosave.
let cmd += [printf('--include=^%s:.*$', fnamemodify(expand('%:p'), ":."))]
let include = [printf('--include=^%s:.*$', fnamemodify(expand('%:p'), ":."))]
if go#util#has_job() || has('nvim')
let include = [printf('--include=^%s:.*$', expand('%:p:t'))]
endif
let cmd += include
endif
" Call gometalinter asynchronously.
@ -52,7 +56,7 @@ function! go#lint#Gometa(autosave, ...) abort
let cmd += goargs
if go#util#has_job() && has('lambda')
if go#util#has_job() || has('nvim')
call s:lint_job({'cmd': cmd}, a:autosave)
return
endif
@ -193,113 +197,46 @@ function! go#lint#ToggleMetaLinterAutoSave() abort
endfunction
function! s:lint_job(args, autosave)
let state = {
\ 'status_dir': expand('%:p:h'),
\ 'started_at': reltime(),
\ 'messages': [],
\ 'exited': 0,
\ 'closed': 0,
\ 'exit_status': 0,
\ 'winid': win_getid(winnr()),
\ 'autosave': a:autosave
\ }
call go#statusline#Update(state.status_dir, {
\ 'desc': "current status",
\ 'type': "gometalinter",
\ 'state': "analysing",
\})
" autowrite is not enabled for jobs
call go#cmd#autowrite()
let l:opts = {
\ 'statustype': "gometalinter",
\ 'errorformat': '%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m',
\ 'for': "GoMetaLinter",
\ }
if a:autosave
let state.listtype = go#list#Type("GoMetaLinterAutoSave")
else
let state.listtype = go#list#Type("GoMetaLinter")
let l:opts.for = "GoMetaLinterAutoSave"
endif
function! s:callback(chan, msg) dict closure
call add(self.messages, a:msg)
endfunction
function! s:exit_cb(job, exitval) dict
let self.exited = 1
let self.exit_status = a:exitval
let status = {
\ 'desc': 'last status',
\ 'type': "gometaliner",
\ 'state': "finished",
\ }
if a:exitval
let status.state = "failed"
endif
let elapsed_time = reltimestr(reltime(self.started_at))
" strip whitespace
let elapsed_time = substitute(elapsed_time, '^\s*\(.\{-}\)\s*$', '\1', '')
let status.state .= printf(" (%ss)", elapsed_time)
call go#statusline#Update(self.status_dir, status)
if self.closed
call self.show_errors()
endif
endfunction
function! s:close_cb(ch) dict
let self.closed = 1
if self.exited
call self.show_errors()
endif
endfunction
function state.show_errors()
let l:winid = win_getid(winnr())
" make sure the current window is the window from which gometalinter was
" run when the listtype is locationlist so that the location list for the
" correct window will be populated.
if self.listtype == 'locationlist'
call win_gotoid(self.winid)
endif
let l:errorformat = '%f:%l:%c:%t%*[^:]:\ %m,%f:%l::%t%*[^:]:\ %m'
call go#list#ParseFormat(self.listtype, l:errorformat, self.messages, 'GoMetaLinter')
let errors = go#list#Get(self.listtype)
call go#list#Window(self.listtype, len(errors))
let l:cbs = go#job#Options(l:opts)
if a:autosave
" move to the window that was active before processing the errors, because
" the user may have moved around within the window or even moved to a
" different window since saving. Moving back to current window as of the
" start of this function avoids the perception that the quickfix window
" steals focus when linting takes a while.
if self.autosave
call win_gotoid(self.winid)
endif
if go#config#EchoCommandInfo()
call go#util#EchoSuccess("linting finished")
endif
endfunction
function! s:exit_cb(next, job, exitval)
let l:winid = win_getid(winnr())
call call(a:next, [a:job, a:exitval])
call win_gotoid(l:winid)
endfunction
" wrap l:cbs.exit_cb in s:exit_cb.
let l:cbs.exit_cb = funcref('s:exit_cb', [l:cbs.exit_cb])
" explicitly bind the callbacks to state so that self within them always
" refers to state. See :help Partial for more information.
let start_options = {
\ 'callback': funcref("s:callback", [], state),
\ 'exit_cb': funcref("s:exit_cb", [], state),
\ 'close_cb': funcref("s:close_cb", [], state),
\ }
call job_start(a:args.cmd, start_options)
if go#config#EchoCommandInfo()
call go#util#EchoProgress("linting started ...")
function! s:close_cb(next, ch)
let l:winid = win_getid(winnr())
call call(a:next, [a:ch])
call win_gotoid(l:winid)
endfunction
" wrap l:cbs.close_cb in s:close_cb.
let l:cbs.close_cb = funcref('s:close_cb', [l:cbs.close_cb])
endif
" autowrite is not enabled for jobs
call go#cmd#autowrite()
call go#job#Start(a:args.cmd, l:cbs)
endfunction
" vim: sw=2 ts=2 et

View File

@ -9,13 +9,6 @@ func! Test_Gometa() abort
" clear the quickfix lists
call setqflist([], 'r')
" call go#lint#ToggleMetaLinterAutoSave from lint.vim so that the file will
" be autoloaded and the default for g:go_metalinter_enabled will be set so
" we can capture it to restore it after the test is run.
silent call go#lint#ToggleMetaLinterAutoSave()
" And restore it back to its previous value
silent call go#lint#ToggleMetaLinterAutoSave()
let g:go_metalinter_enabled = ['golint']
call go#lint#Gometa(0, $GOPATH . '/src/foo')
@ -42,13 +35,6 @@ func! Test_GometaWithDisabled() abort
" clear the quickfix lists
call setqflist([], 'r')
" call go#lint#ToggleMetaLinterAutoSave from lint.vim so that the file will
" be autoloaded and the default for g:go_metalinter_disabled will be set so
" we can capture it to restore it after the test is run.
silent call go#lint#ToggleMetaLinterAutoSave()
" And restore it back to its previous value
silent call go#lint#ToggleMetaLinterAutoSave()
let g:go_metalinter_disabled = ['vet']
call go#lint#Gometa(0, $GOPATH . '/src/foo')
@ -77,13 +63,6 @@ func! Test_GometaAutoSave() abort
" clear the location lists
call setloclist(l:winnr, [], 'r')
" call go#lint#ToggleMetaLinterAutoSave from lint.vim so that the file will
" be autoloaded and the default for g:go_metalinter_autosave_enabled will be
" set so we can capture it to restore it after the test is run.
silent call go#lint#ToggleMetaLinterAutoSave()
" And restore it back to its previous value
silent call go#lint#ToggleMetaLinterAutoSave()
let g:go_metalinter_autosave_enabled = ['golint']
call go#lint#Gometa(1)

View File

@ -27,7 +27,7 @@ function! go#rename#Rename(bang, ...) abort
let offset = printf('%s:#%d', fname, pos)
let cmd = [bin_path, "-offset", offset, "-to", to_identifier, '-tags', go#config#BuildTags()]
if go#util#has_job()
if go#util#has_job() || has('nvim')
call go#util#EchoProgress(printf("renaming to '%s' ...", to_identifier))
call s:rename_job({
\ 'cmd': cmd,
@ -41,63 +41,37 @@ function! go#rename#Rename(bang, ...) abort
endfunction
function s:rename_job(args)
let state = {
\ 'exited': 0,
\ 'closed': 0,
\ 'exitval': 0,
\ 'messages': [],
\ 'status_dir': expand('%:p:h'),
\ 'bang': a:args.bang
\ }
function! s:callback(chan, msg) dict
call add(self.messages, a:msg)
endfunction
function! s:exit_cb(job, exitval) dict
let self.exited = 1
let self.exitval = a:exitval
let status = {
\ 'desc': 'last status',
\ 'type': "gorename",
\ 'state': "finished",
\ }
if a:exitval
let status.state = "failed"
endif
call go#statusline#Update(self.status_dir, status)
if self.closed
call s:parse_errors(self.exitval, self.bang, self.messages)
endif
endfunction
function! s:close_cb(ch) dict
let self.closed = 1
if self.exited
call s:parse_errors(self.exitval, self.bang, self.messages)
endif
endfunction
" explicitly bind the callbacks to state so that self within them always
" refers to state. See :help Partial for more information.
let start_options = {
\ 'callback': funcref("s:callback", [], state),
\ 'exit_cb': funcref("s:exit_cb", [], state),
\ 'close_cb': funcref("s:close_cb", [], state),
let l:job_opts = {
\ 'bang': a:args.bang,
\ 'for': 'GoRename',
\ 'statustype': 'gorename',
\ }
call go#statusline#Update(state.status_dir, {
\ 'desc': "current status",
\ 'type': "gorename",
\ 'state': "started",
\})
" autowrite is not enabled for jobs
call go#cmd#autowrite()
let l:cbs = go#job#Options(l:job_opts)
call job_start(a:args.cmd, start_options)
" wrap l:cbs.exit_cb in s:exit_cb.
let l:cbs.exit_cb = funcref('s:exit_cb', [l:cbs.exit_cb])
call go#job#Start(a:args.cmd, l:cbs)
endfunction
function! s:reload_changed() abort
" reload all files to reflect the new changes. We explicitly call
" checktime to trigger a reload of all files. See
" http://www.mail-archive.com/vim@vim.org/msg05900.html for more info
" about the autoread bug
let current_autoread = &autoread
set autoread
silent! checktime
let &autoread = current_autoread
endfunction
" s:exit_cb reloads any changed buffers and then calls next.
function! s:exit_cb(next, job, exitval) abort
call s:reload_changed()
call call(a:next, [a:job, a:exitval])
endfunction
function s:parse_errors(exit_val, bang, out)
@ -132,9 +106,6 @@ function s:parse_errors(exit_val, bang, out)
call go#util#EchoSuccess(a:out[0])
" refresh the buffer so we can see the new content
" TODO(arslan): also find all other buffers and refresh them too. For this
" we need a way to get the list of changes from gorename upon an success
" change.
silent execute ":e"
endfunction

View File

@ -34,6 +34,10 @@ function! go#test#Test(bang, compile, ...) abort
endif
endif
if has('nvim') && go#config#TermEnabled()
call go#term#new(a:bang, ["go"] + args)
endif
if go#util#has_job() || has('nvim')
" use vim's job functionality to call it asynchronously
let job_options = {

View File

@ -76,10 +76,10 @@ function! go#tool#Imports() abort
return imports
endfunction
function! go#tool#Info(auto) abort
function! go#tool#Info() abort
let l:mode = go#config#InfoMode()
if l:mode == 'gocode'
call go#complete#Info(a:auto)
call go#complete#Info()
elseif l:mode == 'guru'
call go#guru#DescribeInfo()
else

View File

@ -61,7 +61,7 @@ endfunction
" Check if Vim jobs API is supported.
"
" The (optional) first paramter can be added to indicate the 'cwd' or 'env'
" The (optional) first parameter can be added to indicate the 'cwd' or 'env'
" parameters will be used, which wasn't added until a later version.
function! go#util#has_job(...) abort
" cwd and env parameters to job_start was added in this version.

View File

@ -76,7 +76,7 @@ tools developed by the Go community to provide a seamless Vim experience.
==============================================================================
INSTALL *go-install*
vim-go requires at least Vim 7.4.1689 or Neovim 0.2.2. On macOS, if you are
vim-go requires at least Vim 7.4.2009 or Neovim 0.2.2. On macOS, if you are
still using your system version of vim, you can use homebrew to keep your
version of Vim up-to-date with the following terminal command:
>

View File

@ -26,7 +26,7 @@ command! -nargs=* -range GoRemoveTags call go#tags#Remove(<line1>, <line2>, <cou
" -- tool
command! -nargs=* -complete=customlist,go#tool#ValidFiles GoFiles echo go#tool#Files(<f-args>)
command! -nargs=0 GoDeps echo go#tool#Deps()
command! -nargs=* GoInfo call go#tool#Info(0)
command! -nargs=0 GoInfo call go#tool#Info()
command! -nargs=0 GoAutoTypeInfoToggle call go#complete#ToggleAutoTypeInfo()
" -- cmd

View File

@ -31,7 +31,7 @@ nnoremap <silent> <Plug>(go-coverage-browser) :<C-u>call go#coverage#Browser(!g:
nnoremap <silent> <Plug>(go-files) :<C-u>call go#tool#Files()<CR>
nnoremap <silent> <Plug>(go-deps) :<C-u>call go#tool#Deps()<CR>
nnoremap <silent> <Plug>(go-info) :<C-u>call go#tool#Info(0)<CR>
nnoremap <silent> <Plug>(go-info) :<C-u>call go#tool#Info()<CR>
nnoremap <silent> <Plug>(go-import) :<C-u>call go#import#SwitchImport(1, '', expand('<cword>'), '')<CR>
nnoremap <silent> <Plug>(go-imports) :<C-u>call go#fmt#Format(1)<CR>

View File

@ -4,23 +4,24 @@ if exists("g:go_loaded_install")
endif
let g:go_loaded_install = 1
" Not using the has('patch-7.4.1689') syntax because that wasn't added until
" Not using the has('patch-7.4.2009') syntax because that wasn't added until
" 7.4.237, and we want to be sure this works for everyone (this is also why
" we're not using utils#EchoError()).
"
" Version 7.4.1689 was chosen because that's what the most recent Ubuntu LTS
" release (16.04) uses.
" Version 7.4.2009 was chosen because that's greater than what the most recent Ubuntu LTS
" release (16.04) uses and has a couple of features we need (e.g. execute()
" and :message clear).
if
\ go#config#VersionWarning() != 0 &&
\ (v:version < 704 || (v:version == 704 && !has('patch1689')))
\ (v:version < 704 || (v:version == 704 && !has('patch2009')))
\ && !has('nvim')
echohl Error
echom "vim-go requires Vim 7.4.1689 or Neovim, but you're using an older version."
echom "vim-go requires Vim 7.4.2009 or Neovim, but you're using an older version."
echom "Please update your Vim for the best vim-go experience."
echom "If you really want to continue you can set this to make the error go away:"
echom " let g:go_version_warning = 0"
echom "Note that some features may error out or behave incorrectly."
echom "Please do not report bugs unless you're using Vim 7.4.1689 or newer."
echom "Please do not report bugs unless you're using Vim 7.4.2009 or newer."
echohl None
" Make sure people see this.
@ -45,7 +46,7 @@ let s:packages = {
\ 'gotags': ['github.com/jstemmer/gotags'],
\ 'guru': ['golang.org/x/tools/cmd/guru'],
\ 'impl': ['github.com/josharian/impl'],
\ 'keyify': ['github.com/dominikh/go-tools/cmd/keyify'],
\ 'keyify': ['honnef.co/go/tools/cmd/keyify'],
\ 'motion': ['github.com/fatih/motion'],
\ 'iferr': ['github.com/koron/iferr'],
\ }
@ -200,7 +201,7 @@ endfunction
function! s:auto_type_info()
" GoInfo automatic update
if get(g:, "go_auto_type_info", 0)
call go#tool#Info(1)
call go#tool#Info()
endif
endfunction

View File

@ -16,8 +16,7 @@ vim=${1:-}
case "$vim" in
"vim-7.4")
# This is what the most recent Ubuntu LTS (16.04) ships with.
tag="v7.4.1689"
tag="v7.4.2009"
giturl="https://github.com/vim/vim"
;;

View File

@ -16,6 +16,15 @@ if !exists('g:test_verbose')
endif
let g:go_echo_command_info = 0
function! s:logmessages() abort
" Add all messages (usually errors).
redir => s:mess
silent messages
redir END
let s:logs = s:logs + filter(split(s:mess, "\n"), 'v:val !~ "^Messages maintainer"')
silent messages clear
endfunction
" Source the passed test file.
source %
@ -31,12 +40,14 @@ let g:vim_go_root = fnamemodify(getcwd(), ':p')
redir @q
silent function /^Test_
redir END
let s:tests = split(substitute(@q, 'function \(\k*()\)', '\1', 'g'))
let s:tests = split(substitute(@q, 'function \(\k\+()\)', '\1', 'g'))
" log any messages that we may already accumulated.
call s:logmessages()
" Iterate over all tests and execute them.
for s:test in sort(s:tests)
" Since we extract the tests from a regexp the "abort" keyword is also in the
" list, which is not a test name :-)
" Since we extract the tests from a regexp the "abort" keyword is also in
" the list, which is not a test name :-)
if s:test == 'abort'
continue
endif
@ -57,6 +68,8 @@ for s:test in sort(s:tests)
let s:elapsed_time = substitute(reltimestr(reltime(s:started)), '^\s*\(.\{-}\)\s*$', '\1', '')
let s:done += 1
call s:logmessages()
if len(v:errors) > 0
let s:fail += 1
call add(s:logs, printf("--- FAIL %s (%ss)", s:test[:-3], s:elapsed_time))
@ -79,12 +92,6 @@ endif
let s:total_elapsed_time = substitute(reltimestr(reltime(s:total_started)), '^\s*\(.\{-}\)\s*$', '\1', '')
" Add all messages (usually errors).
redir => s:mess
silent messages
redir END
let s:logs = s:logs + filter(split(s:mess, "\n"), 'v:val !~ "^Messages maintainer"')
" Also store all internal messages from s:logs as well.
silent! split /tmp/vim-go-test/test.tmp
call append(line('$'), s:logs)

View File

@ -214,6 +214,7 @@ endif
" Extra types commonly seen
if go#config#HighlightExtraTypes()
syn match goExtraType /\<bytes\.\(Buffer\)\>/
syn match goExtraType /\<context\.\(Context\)\>/
syn match goExtraType /\<io\.\(Reader\|ReadSeeker\|ReadWriter\|ReadCloser\|ReadWriteCloser\|Writer\|WriteCloser\|Seeker\)\>/
syn match goExtraType /\<reflect\.\(Kind\|Type\|Value\)\>/
syn match goExtraType /\<unsafe\.Pointer\>/