Update some plugins.
This commit is contained in:
parent
f6ba361e3e
commit
bbbedb5311
15 changed files with 204 additions and 79 deletions
|
@ -27,7 +27,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
go: ['1.17','1.18']
|
go: ['1.18','1.19']
|
||||||
vim: ['vim-8.0', 'vim-8.2', 'nvim']
|
vim: ['vim-8.0', 'vim-8.2', 'nvim']
|
||||||
steps:
|
steps:
|
||||||
- name: setup Go
|
- name: setup Go
|
||||||
|
|
|
@ -8,8 +8,14 @@ IMPROVEMENTS:
|
||||||
* Show diagnostics via go#tool#DescribeBalloon().
|
* Show diagnostics via go#tool#DescribeBalloon().
|
||||||
[[GH-3415]](https://github.com/fatih/vim-go/pull/3415)
|
[[GH-3415]](https://github.com/fatih/vim-go/pull/3415)
|
||||||
[[GH-3417]](https://github.com/fatih/vim-go/pull/3417)
|
[[GH-3417]](https://github.com/fatih/vim-go/pull/3417)
|
||||||
|
* Allow version of individual tools to be installed with `:GoUpdateBinaries`
|
||||||
|
and `:GoInstallBinaries` to be overridden by users.
|
||||||
|
[[GH-3435]](https://github.com/fatih/vim-go/pull/3435)
|
||||||
|
[[GH-3436]](https://github.com/fatih/vim-go/pull/3436)
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
* Fix quoting of arguments when shell is set to pwsh on Windows.
|
||||||
|
[[GH-3422]](https://github.com/fatih/vim-go/pull/3422)
|
||||||
|
|
||||||
## v1.26 - (April 23, 2022)
|
## v1.26 - (April 23, 2022)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.18.1
|
FROM golang:1.19.0
|
||||||
|
|
||||||
RUN apt-get update -y --allow-insecure-repositories && \
|
RUN apt-get update -y --allow-insecure-repositories && \
|
||||||
apt-get install -y build-essential curl git libncurses5-dev python3-pip && \
|
apt-get install -y build-essential curl git libncurses5-dev python3-pip && \
|
||||||
|
|
|
@ -28,9 +28,18 @@ function! Test_GoDebugStart_Errors() abort
|
||||||
|
|
||||||
let l:expected = [
|
let l:expected = [
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# vim-go.test/debug/compilerror'},
|
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# vim-go.test/debug/compilerror'},
|
||||||
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'},
|
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline in argument list; possibly missing comma or )'},
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
|
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
|
||||||
\]
|
\]
|
||||||
|
let [l:goversion, l:err] = go#util#Exec(['go', 'env', 'GOVERSION'])
|
||||||
|
let l:goversion = split(l:goversion, "\n")[0]
|
||||||
|
if l:goversion < 'go1.19'
|
||||||
|
let expected = [
|
||||||
|
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': '# vim-go.test/debug/compilerror'},
|
||||||
|
\ {'lnum': 6, 'bufnr': bufnr('%'), 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': ' syntax error: unexpected newline, expecting comma or )'},
|
||||||
|
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'valid': 0, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exit status 2'}
|
||||||
|
\ ]
|
||||||
|
endif
|
||||||
call setqflist([], 'r')
|
call setqflist([], 'r')
|
||||||
|
|
||||||
call assert_false(exists(':GoDebugStop'))
|
call assert_false(exists(':GoDebugStop'))
|
||||||
|
|
|
@ -44,8 +44,8 @@ func! s:gometa(metalinter) abort
|
||||||
let actual = copy(getqflist())
|
let actual = copy(getqflist())
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" sort the results, because golangci-lint seems to be returning the golint
|
" sort the results, because golangci-lint doesn't always return notices in
|
||||||
" deprecation notice in a non-deterministic order.
|
" a deterministic order.
|
||||||
call sort(l:actual)
|
call sort(l:actual)
|
||||||
call sort(l:expected)
|
call sort(l:expected)
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ func! s:gometaautosave(metalinter, withList) abort
|
||||||
let l:actual = copy(getloclist(0))
|
let l:actual = copy(getloclist(0))
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" sort the results, because golangci-lint seems to be returning the golint
|
" sort the results, because golangci-lint doesn't always return notices in
|
||||||
" deprecation notice in a non-deterministic order.
|
" a deterministic order.
|
||||||
call sort(l:actual)
|
call sort(l:actual)
|
||||||
call sort(l:expected)
|
call sort(l:expected)
|
||||||
|
|
||||||
|
@ -176,48 +176,47 @@ func! s:gometaautosave(metalinter, withList) abort
|
||||||
endtry
|
endtry
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
func! Test_GometaGolangciLint_importabs() abort
|
"func! Test_GometaGolangciLint_importabs() abort
|
||||||
call s:gometa_importabs('golangci-lint')
|
" call s:gometa_importabs('golangci-lint')
|
||||||
endfunc
|
"endfunc
|
||||||
|
"
|
||||||
func! s:gometa_importabs(metalinter) abort
|
"func! s:gometa_importabs(metalinter) abort
|
||||||
let RestoreGOPATH = go#util#SetEnv('GOPATH', fnamemodify(getcwd(), ':p') . 'test-fixtures/lint')
|
" let RestoreGOPATH = go#util#SetEnv('GOPATH', fnamemodify(getcwd(), ':p') . 'test-fixtures/lint')
|
||||||
silent exe 'e! ' . $GOPATH . '/src/lint/golangci-lint/problems/importabs/problems.go'
|
" silent exe 'e! ' . $GOPATH . '/src/lint/golangci-lint/problems/importabs/problems.go'
|
||||||
|
"
|
||||||
try
|
" try
|
||||||
let g:go_metalinter_command = a:metalinter
|
" let g:go_metalinter_command = a:metalinter
|
||||||
|
"
|
||||||
let expected = [
|
" let expected = [
|
||||||
\ {'lnum': 3, 'bufnr': bufnr('%'), 'col': 8, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"/quux" imported but not used (typecheck)'},
|
" \ {'lnum': 3, 'bufnr': bufnr('%'), 'col': 8, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"/quux" imported but not used (typecheck)'},
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
|
" \ ]
|
||||||
\ ]
|
" " clear the quickfix list
|
||||||
" clear the quickfix list
|
" call setqflist([], 'r')
|
||||||
call setqflist([], 'r')
|
"
|
||||||
|
" let g:go_metalinter_enabled = ['revive', 'typecheck']
|
||||||
let g:go_metalinter_enabled = ['golint']
|
"
|
||||||
|
" call go#lint#Gometa(0, 0)
|
||||||
call go#lint#Gometa(0, 0)
|
"
|
||||||
|
" let actual = getqflist()
|
||||||
let actual = getqflist()
|
" let start = reltime()
|
||||||
let start = reltime()
|
" while len(actual) == 0 && reltimefloat(reltime(start)) < 10
|
||||||
while len(actual) == 0 && reltimefloat(reltime(start)) < 10
|
" sleep 100m
|
||||||
sleep 100m
|
" let actual = copy(getqflist())
|
||||||
let actual = copy(getqflist())
|
" endwhile
|
||||||
endwhile
|
"
|
||||||
|
" " sort the results, because golangci-lint doesn't always return notices in
|
||||||
" sort the results, because golangci-lint seems to be returning the golint
|
" " a deterministic order.
|
||||||
" deprecation notice in a non-deterministic order.
|
" call sort(l:actual)
|
||||||
call sort(l:actual)
|
" call sort(l:expected)
|
||||||
call sort(l:expected)
|
"
|
||||||
|
" call gotest#assert_quickfix(actual, expected)
|
||||||
call gotest#assert_quickfix(actual, expected)
|
" finally
|
||||||
finally
|
" call call(RestoreGOPATH, [])
|
||||||
call call(RestoreGOPATH, [])
|
" unlet g:go_metalinter_enabled
|
||||||
unlet g:go_metalinter_enabled
|
" unlet g:go_metalinter_command
|
||||||
unlet g:go_metalinter_command
|
" endtry
|
||||||
endtry
|
"endfunc
|
||||||
endfunc
|
"
|
||||||
|
|
||||||
"func! Test_GometaAutoSaveGolangciLint_importabs() abort
|
"func! Test_GometaAutoSaveGolangciLint_importabs() abort
|
||||||
" call s:gometaautosave_importabs('golangci-lint')
|
" call s:gometaautosave_importabs('golangci-lint')
|
||||||
"endfunc
|
"endfunc
|
||||||
|
@ -266,7 +265,6 @@ func! s:gometa_multiple(metalinter) abort
|
||||||
try
|
try
|
||||||
let g:go_metalinter_command = a:metalinter
|
let g:go_metalinter_command = a:metalinter
|
||||||
let expected = [
|
let expected = [
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
|
|
||||||
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
|
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
|
||||||
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
|
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
|
||||||
\ ]
|
\ ]
|
||||||
|
@ -274,7 +272,7 @@ func! s:gometa_multiple(metalinter) abort
|
||||||
" clear the quickfix list
|
" clear the quickfix list
|
||||||
call setqflist([], 'r')
|
call setqflist([], 'r')
|
||||||
|
|
||||||
let g:go_metalinter_enabled = ['revive']
|
let g:go_metalinter_enabled = ['revive', 'typecheck']
|
||||||
|
|
||||||
call go#lint#Gometa(0, 0)
|
call go#lint#Gometa(0, 0)
|
||||||
|
|
||||||
|
@ -285,8 +283,8 @@ func! s:gometa_multiple(metalinter) abort
|
||||||
let actual = copy(getqflist())
|
let actual = copy(getqflist())
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" sort the results, because golangci-lint seems to be returning the golint
|
" sort the results, because golangci-lint doesn't always return notices in
|
||||||
" deprecation notice in a non-deterministic order.
|
" a deterministic order.
|
||||||
call sort(l:actual)
|
call sort(l:actual)
|
||||||
call sort(l:expected)
|
call sort(l:expected)
|
||||||
|
|
||||||
|
@ -309,7 +307,6 @@ func! s:gometaautosave_multiple(metalinter) abort
|
||||||
try
|
try
|
||||||
let g:go_metalinter_command = a:metalinter
|
let g:go_metalinter_command = a:metalinter
|
||||||
let expected = [
|
let expected = [
|
||||||
\ {'lnum': 0, 'bufnr': 0, 'col': 0, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': 'w', 'module': '', 'text': '[runner] The linter ''golint'' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive.'},
|
|
||||||
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
|
\ {'lnum': 8, 'bufnr': bufnr('%'), 'col': 7, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': 'time.Sleep undefined (type int has no field or method Sleep) (typecheck)'},
|
||||||
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
|
\ {'lnum': 4, 'bufnr': bufnr('%'), 'col': 2, 'pattern': '', 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'module': '', 'text': '"time" imported but not used (typecheck)'}
|
||||||
\ ]
|
\ ]
|
||||||
|
@ -317,7 +314,7 @@ func! s:gometaautosave_multiple(metalinter) abort
|
||||||
" clear the location list
|
" clear the location list
|
||||||
call setloclist(0, [], 'r')
|
call setloclist(0, [], 'r')
|
||||||
|
|
||||||
let g:go_metalinter_autosave_enabled = ['golint']
|
let g:go_metalinter_autosave_enabled = ['revive', 'typecheck']
|
||||||
|
|
||||||
call go#lint#Gometa(0, 1)
|
call go#lint#Gometa(0, 1)
|
||||||
|
|
||||||
|
@ -328,8 +325,8 @@ func! s:gometaautosave_multiple(metalinter) abort
|
||||||
let actual = copy(getloclist(0))
|
let actual = copy(getloclist(0))
|
||||||
endwhile
|
endwhile
|
||||||
|
|
||||||
" sort the results, because golangci-lint seems to be returning the golint
|
" sort the results, because golangci-lint doesn't always return notices in
|
||||||
" deprecation notice in a non-deterministic order.
|
" a deterministic order.
|
||||||
call sort(l:actual)
|
call sort(l:actual)
|
||||||
call sort(l:expected)
|
call sort(l:expected)
|
||||||
|
|
||||||
|
@ -455,6 +452,7 @@ func! Test_Lint_GOPATH() abort
|
||||||
compiler go
|
compiler go
|
||||||
|
|
||||||
let expected = [
|
let expected = [
|
||||||
|
\ {'lnum': 1, 'bufnr': bufnr('%')+9, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'should have a package comment'},
|
||||||
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
|
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
|
||||||
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
|
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
|
||||||
\ ]
|
\ ]
|
||||||
|
@ -492,6 +490,7 @@ func! Test_Lint_NullModule() abort
|
||||||
compiler go
|
compiler go
|
||||||
|
|
||||||
let expected = [
|
let expected = [
|
||||||
|
\ {'lnum': 1, 'bufnr': bufnr('%')+9, 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'should have a package comment'},
|
||||||
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
|
\ {'lnum': 5, 'bufnr': bufnr('%'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function MissingDoc should have comment or be unexported'},
|
||||||
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
|
\ {'lnum': 5, 'bufnr': bufnr('test-fixtures/lint/src/lint/quux.go'), 'col': 1, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'exported function AlsoMissingDoc should have comment or be unexported'}
|
||||||
\ ]
|
\ ]
|
||||||
|
|
|
@ -48,8 +48,16 @@ endfunc
|
||||||
|
|
||||||
func! Test_GoTestCompilerError() abort
|
func! Test_GoTestCompilerError() abort
|
||||||
let expected = [
|
let expected = [
|
||||||
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline, expecting comma or )'}
|
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline in argument list; possibly missing comma or )'}
|
||||||
\ ]
|
\ ]
|
||||||
|
let [l:goversion, l:err] = go#util#Exec(['go', 'env', 'GOVERSION'])
|
||||||
|
let l:goversion = split(l:goversion, "\n")[0]
|
||||||
|
if l:goversion < 'go1.19'
|
||||||
|
let expected = [
|
||||||
|
\ {'lnum': 6, 'bufnr': 6, 'col': 22, 'valid': 1, 'vcol': 0, 'nr': -1, 'type': '', 'pattern': '', 'text': 'syntax error: unexpected newline, expecting comma or )'}
|
||||||
|
\ ]
|
||||||
|
endif
|
||||||
|
|
||||||
call s:test('compilerror/compilerror_test.go', expected)
|
call s:test('compilerror/compilerror_test.go', expected)
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|
|
@ -298,7 +298,21 @@ endfunction
|
||||||
" Shelljoin returns a shell-safe string representation of arglist. The
|
" Shelljoin returns a shell-safe string representation of arglist. The
|
||||||
" {special} argument of shellescape() may optionally be passed.
|
" {special} argument of shellescape() may optionally be passed.
|
||||||
function! go#util#Shelljoin(arglist, ...) abort
|
function! go#util#Shelljoin(arglist, ...) abort
|
||||||
|
" Preserve original shell. This needs to be kept in sync with how s:system
|
||||||
|
" sets shell.
|
||||||
|
let l:shell = &shell
|
||||||
|
|
||||||
try
|
try
|
||||||
|
if !go#util#IsWin() && executable('/bin/sh')
|
||||||
|
set shell=/bin/sh
|
||||||
|
endif
|
||||||
|
|
||||||
|
if go#util#IsWin()
|
||||||
|
if executable($COMSPEC)
|
||||||
|
let &shell = $COMSPEC
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
let ssl_save = &shellslash
|
let ssl_save = &shellslash
|
||||||
set noshellslash
|
set noshellslash
|
||||||
if a:0
|
if a:0
|
||||||
|
@ -307,20 +321,12 @@ function! go#util#Shelljoin(arglist, ...) abort
|
||||||
|
|
||||||
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
|
return join(map(copy(a:arglist), 'shellescape(v:val)'), ' ')
|
||||||
finally
|
finally
|
||||||
|
" Restore original values
|
||||||
let &shellslash = ssl_save
|
let &shellslash = ssl_save
|
||||||
|
let &shell = l:shell
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
fu! go#util#Shellescape(arg)
|
|
||||||
try
|
|
||||||
let ssl_save = &shellslash
|
|
||||||
set noshellslash
|
|
||||||
return shellescape(a:arg)
|
|
||||||
finally
|
|
||||||
let &shellslash = ssl_save
|
|
||||||
endtry
|
|
||||||
endf
|
|
||||||
|
|
||||||
" Shelllist returns a shell-safe representation of the items in the given
|
" Shelllist returns a shell-safe representation of the items in the given
|
||||||
" arglist. The {special} argument of shellescape() may optionally be passed.
|
" arglist. The {special} argument of shellescape() may optionally be passed.
|
||||||
function! go#util#Shelllist(arglist, ...) abort
|
function! go#util#Shelllist(arglist, ...) abort
|
||||||
|
@ -328,9 +334,9 @@ function! go#util#Shelllist(arglist, ...) abort
|
||||||
let ssl_save = &shellslash
|
let ssl_save = &shellslash
|
||||||
set noshellslash
|
set noshellslash
|
||||||
if a:0
|
if a:0
|
||||||
return map(copy(a:arglist), 'shellescape(v:val, ' . a:1 . ')')
|
return map(copy(a:arglist), 'go#util#Shelljoin(v:val, ' . a:1 . ')')
|
||||||
endif
|
endif
|
||||||
return map(copy(a:arglist), 'shellescape(v:val)')
|
return map(copy(a:arglist), 'go#util#Shelljoin(v:val)')
|
||||||
finally
|
finally
|
||||||
let &shellslash = ssl_save
|
let &shellslash = ssl_save
|
||||||
endtry
|
endtry
|
||||||
|
|
|
@ -500,6 +500,9 @@ CTRL-t
|
||||||
supplied, then only the specified binaries will be installed. The default
|
supplied, then only the specified binaries will be installed. The default
|
||||||
is to install everything.
|
is to install everything.
|
||||||
|
|
||||||
|
A specific version of a binary can be specified by appending Go's version
|
||||||
|
syntax to the binary name. e.g. `:GoInstallBinaries gopls@v0.9.1`.
|
||||||
|
|
||||||
Set |'g:go_get_update'| to disable updating dependencies.
|
Set |'g:go_get_update'| to disable updating dependencies.
|
||||||
|
|
||||||
*:GoUpdateBinaries*
|
*:GoUpdateBinaries*
|
||||||
|
@ -510,6 +513,9 @@ CTRL-t
|
||||||
supplied, then only the specified binaries will be updated. The default is
|
supplied, then only the specified binaries will be updated. The default is
|
||||||
to update everything.
|
to update everything.
|
||||||
|
|
||||||
|
A specific version of a binary can be specified by appending Go's version
|
||||||
|
syntax to the binary name. e.g. `:GoUpdateBinaries gopls@v0.9.1`.
|
||||||
|
|
||||||
Set |'g:go_get_update'| to disable updating dependencies.
|
Set |'g:go_get_update'| to disable updating dependencies.
|
||||||
|
|
||||||
*:GoImplements*
|
*:GoImplements*
|
||||||
|
@ -1989,7 +1995,7 @@ use different templates for different projects.
|
||||||
*'g:go_template_test_file'*
|
*'g:go_template_test_file'*
|
||||||
|
|
||||||
Like with |'g:go_template_file'|, this specifies the file to use for test
|
Like with |'g:go_template_file'|, this specifies the file to use for test
|
||||||
tempaltes. The template file should be under the `templates` folder,
|
templates. The template file should be under the `templates` folder,
|
||||||
alternatively absolute paths can be used, too. Checkout
|
alternatively absolute paths can be used, too. Checkout
|
||||||
|'g:go_template_autocreate'| for more info. By default, the
|
|'g:go_template_autocreate'| for more info. By default, the
|
||||||
`hello_world_test.go` file is used.
|
`hello_world_test.go` file is used.
|
||||||
|
|
|
@ -113,11 +113,21 @@ function! s:GoInstallBinaries(updateBinaries, ...)
|
||||||
let l:packages = {}
|
let l:packages = {}
|
||||||
if a:0 > 0
|
if a:0 > 0
|
||||||
for l:bin in a:000
|
for l:bin in a:000
|
||||||
|
let l:version = substitute(l:bin, '.*@', '', '')
|
||||||
|
if l:version == l:bin
|
||||||
|
let l:version = ''
|
||||||
|
endif
|
||||||
|
let l:bin = substitute(l:bin, '@.*', '', '')
|
||||||
|
|
||||||
let l:pkg = get(s:packages, l:bin, [])
|
let l:pkg = get(s:packages, l:bin, [])
|
||||||
if len(l:pkg) == 0
|
if len(l:pkg) == 0
|
||||||
call go#util#EchoError('unknown binary: ' . l:bin)
|
call go#util#EchoError('unknown binary: ' . l:bin)
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if l:version isnot ''
|
||||||
|
let l:pkg[0] = substitute(l:pkg[0], '@\zs.*', l:version, '')
|
||||||
|
endif
|
||||||
let l:packages[l:bin] = l:pkg
|
let l:packages[l:bin] = l:pkg
|
||||||
endfor
|
endfor
|
||||||
else
|
else
|
||||||
|
|
|
@ -92,7 +92,7 @@ let s:ruby_indent_keywords =
|
||||||
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
|
\ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>'
|
||||||
|
|
||||||
" Def without an end clause: def method_call(...) = <expression>
|
" Def without an end clause: def method_call(...) = <expression>
|
||||||
let s:ruby_endless_def = '\<def\s\+\k\+[!?]\=\%((.*)\|\s\)\s*='
|
let s:ruby_endless_def = '\<def\s\+\%(\k\+\.\)\=\k\+[!?]\=\%((.*)\|\s\)\s*='
|
||||||
|
|
||||||
" Regex used for words that, at the start of a line, remove a level of indent.
|
" Regex used for words that, at the start of a line, remove a level of indent.
|
||||||
let s:ruby_deindent_keywords =
|
let s:ruby_deindent_keywords =
|
||||||
|
|
|
@ -70,6 +70,10 @@ describe "Indenting" do
|
||||||
def foo(
|
def foo(
|
||||||
bar
|
bar
|
||||||
) = puts(bar)
|
) = puts(bar)
|
||||||
|
|
||||||
|
# Reference: https://github.com/vim-ruby/vim-ruby/issues/450
|
||||||
|
def self.foo = puts(bar)
|
||||||
|
def bar.foo = puts(baz)
|
||||||
end
|
end
|
||||||
EOF
|
EOF
|
||||||
end
|
end
|
||||||
|
|
|
@ -343,6 +343,18 @@ write_init_body(args, t[2], snip)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
|
snippet dcl "dataclass" b
|
||||||
|
@dataclass
|
||||||
|
class ${1:MyClass}:
|
||||||
|
`!p snip.rv = triple_quotes(snip)`${2:Docstring for $1. }`!p snip.rv = triple_quotes(snip)`
|
||||||
|
${3:var_1}: ${4:int}
|
||||||
|
${5:var_2}: ${6:float} = ${7:0}
|
||||||
|
|
||||||
|
def ${8:total}(self): -> $6:
|
||||||
|
return ${0:self.$3 * self.$5}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
snippet contain "methods for emulating a container type" b
|
snippet contain "methods for emulating a container type" b
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
${1:pass}
|
${1:pass}
|
||||||
|
@ -603,9 +615,9 @@ $1 = property(**$1(), doc=$1.__doc__)
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
####################
|
############################
|
||||||
# If / Else / Elif #
|
# If / Else / Elif / Match #
|
||||||
####################
|
############################
|
||||||
snippet if "If" b
|
snippet if "If" b
|
||||||
if ${1:condition}:
|
if ${1:condition}:
|
||||||
${2:${VISUAL:pass}}
|
${2:${VISUAL:pass}}
|
||||||
|
@ -627,6 +639,22 @@ else:
|
||||||
${5:pass}
|
${5:pass}
|
||||||
endsnippet
|
endsnippet
|
||||||
|
|
||||||
|
snippet match "Structural pattern matching" b
|
||||||
|
match ${1:expression}:
|
||||||
|
case ${2:pattern_1}:
|
||||||
|
${3:pass}
|
||||||
|
case ${4:pattern_2}:
|
||||||
|
${0:pass}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet matchw "Pattern matching with wildcard" b
|
||||||
|
match ${1:expression}:
|
||||||
|
case ${2:pattern_1}:
|
||||||
|
${3:pass}
|
||||||
|
case _:
|
||||||
|
${0:pass}
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Try / Except / Finally #
|
# Try / Except / Finally #
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name" : "snipmate-snippets",
|
"name" : "vim-snippets",
|
||||||
"author" : "community",
|
"author" : "community",
|
||||||
"maintainer" : "honza @ github & others",
|
"maintainer" : "honza @ github & others",
|
||||||
"repository" : {"type": "git", "url": "git://github.com/honza/snipmate-snippets.git"},
|
"repository" : {"type": "git", "url": "git://github.com/honza/vim-snippets.git"},
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
"description" : "community driven set of snippets for snipmate"
|
"description" : "community driven set of snippets for snipmate"
|
||||||
|
|
|
@ -12,6 +12,7 @@ snippet uni
|
||||||
${0:representation}
|
${0:representation}
|
||||||
snippet from
|
snippet from
|
||||||
from ${1:package} import ${0:module}
|
from ${1:package} import ${0:module}
|
||||||
|
|
||||||
# Module Docstring
|
# Module Docstring
|
||||||
snippet docs
|
snippet docs
|
||||||
"""
|
"""
|
||||||
|
@ -29,18 +30,22 @@ snippet sk "skip unittests" b
|
||||||
snippet wh
|
snippet wh
|
||||||
while ${1:condition}:
|
while ${1:condition}:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
|
|
||||||
# dowh - does the same as do...while in other languages
|
# dowh - does the same as do...while in other languages
|
||||||
snippet dowh
|
snippet dowh
|
||||||
while True:
|
while True:
|
||||||
${1}
|
${1}
|
||||||
if ${0:condition}:
|
if ${0:condition}:
|
||||||
break
|
break
|
||||||
|
|
||||||
snippet with
|
snippet with
|
||||||
with ${1:expr} as ${2:var}:
|
with ${1:expr} as ${2:var}:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
|
|
||||||
snippet awith
|
snippet awith
|
||||||
async with ${1:expr} as ${2:var}:
|
async with ${1:expr} as ${2:var}:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
|
|
||||||
# New Class
|
# New Class
|
||||||
snippet cl
|
snippet cl
|
||||||
class ${1:ClassName}(${2:object}):
|
class ${1:ClassName}(${2:object}):
|
||||||
|
@ -52,11 +57,24 @@ snippet cl
|
||||||
snippet cla
|
snippet cla
|
||||||
class ${1:class_name}:
|
class ${1:class_name}:
|
||||||
"""${0:description}"""
|
"""${0:description}"""
|
||||||
|
|
||||||
snippet clai
|
snippet clai
|
||||||
class ${1:class_name}:
|
class ${1:class_name}:
|
||||||
"""${2:description}"""
|
"""${2:description}"""
|
||||||
def __init__(self, ${3:args}):
|
def __init__(self, ${3:args}):
|
||||||
${0}
|
${0}
|
||||||
|
|
||||||
|
# Data class
|
||||||
|
snippet dcl dataclass
|
||||||
|
@dataclass
|
||||||
|
class ${1:ClassName}:
|
||||||
|
"""${2:description}"""
|
||||||
|
${3:var_1}: ${4:int}
|
||||||
|
${5:var_2}: ${6:float} = ${7:0}
|
||||||
|
|
||||||
|
def ${8:total}(self): -> $6:
|
||||||
|
return ${0:self.$3 * self.$5}
|
||||||
|
|
||||||
# New Function
|
# New Function
|
||||||
snippet def
|
snippet def
|
||||||
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||||
|
@ -72,6 +90,7 @@ snippet adef
|
||||||
snippet adeff
|
snippet adeff
|
||||||
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||||
${0}
|
${0}
|
||||||
|
|
||||||
# New Method
|
# New Method
|
||||||
snippet defi
|
snippet defi
|
||||||
def __init__(self, ${1:args}):
|
def __init__(self, ${1:args}):
|
||||||
|
@ -104,10 +123,28 @@ snippet el
|
||||||
snippet ei
|
snippet ei
|
||||||
elif ${1:condition}:
|
elif ${1:condition}:
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
|
|
||||||
|
# Match
|
||||||
|
snippet match Structural pattern matching
|
||||||
|
match ${1:expression}:
|
||||||
|
case ${2:pattern_1}:
|
||||||
|
${3:pass}
|
||||||
|
case ${4:pattern_2}:
|
||||||
|
${5:pass}
|
||||||
|
|
||||||
|
# Match with wildcard
|
||||||
|
snippet matchw Pattern matching with wildcard
|
||||||
|
match ${1:expression}:
|
||||||
|
case ${2:pattern_1}:
|
||||||
|
${3:pass}
|
||||||
|
case _:
|
||||||
|
${0:pass}
|
||||||
|
|
||||||
# For
|
# For
|
||||||
snippet for
|
snippet for
|
||||||
for ${1:item} in ${2:items}:
|
for ${1:item} in ${2:items}:
|
||||||
${0}
|
${0}
|
||||||
|
|
||||||
# Encodes
|
# Encodes
|
||||||
snippet cutf8
|
snippet cutf8
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
@ -115,15 +152,18 @@ snippet clatin1
|
||||||
# -*- coding: latin-1 -*-
|
# -*- coding: latin-1 -*-
|
||||||
snippet cascii
|
snippet cascii
|
||||||
# -*- coding: ascii -*-
|
# -*- coding: ascii -*-
|
||||||
|
|
||||||
# Lambda
|
# Lambda
|
||||||
snippet ld
|
snippet ld
|
||||||
${1:var} = lambda ${2:vars} : ${0:action}
|
${1:var} = lambda ${2:vars} : ${0:action}
|
||||||
|
|
||||||
snippet ret
|
snippet ret
|
||||||
return ${0}
|
return ${0}
|
||||||
snippet .
|
snippet .
|
||||||
self.
|
self.
|
||||||
snippet sa self.attribute = attribute
|
snippet sa self.attribute = attribute
|
||||||
self.${1:attribute} = $1
|
self.${1:attribute} = $1
|
||||||
|
|
||||||
snippet try Try/Except
|
snippet try Try/Except
|
||||||
try:
|
try:
|
||||||
${1:${VISUAL}}
|
${1:${VISUAL}}
|
||||||
|
@ -152,6 +192,7 @@ snippet tryef Try/Except/Else/Finally
|
||||||
${5}
|
${5}
|
||||||
finally:
|
finally:
|
||||||
${0}
|
${0}
|
||||||
|
|
||||||
# if __name__ == '__main__':
|
# if __name__ == '__main__':
|
||||||
snippet ifmain
|
snippet ifmain
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -196,9 +237,11 @@ snippet nosetrace
|
||||||
__import__('nose').tools.set_trace()
|
__import__('nose').tools.set_trace()
|
||||||
snippet pprint
|
snippet pprint
|
||||||
__import__('pprint').pprint(${1})
|
__import__('pprint').pprint(${1})
|
||||||
|
|
||||||
snippet "
|
snippet "
|
||||||
"""${0:doc}
|
"""${0:doc}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# assertions
|
# assertions
|
||||||
snippet a=
|
snippet a=
|
||||||
self.assertEqual(${0}, ${1})
|
self.assertEqual(${0}, ${1})
|
||||||
|
@ -219,6 +262,7 @@ snippet tgwt
|
||||||
# then: ${3}
|
# then: ${3}
|
||||||
snippet fut
|
snippet fut
|
||||||
from __future__ import ${0}
|
from __future__ import ${0}
|
||||||
|
|
||||||
#getopt
|
#getopt
|
||||||
snippet getopt
|
snippet getopt
|
||||||
try:
|
try:
|
||||||
|
@ -236,6 +280,7 @@ snippet getopt
|
||||||
${0}
|
${0}
|
||||||
elif option in ("-v", "--verbose"):
|
elif option in ("-v", "--verbose"):
|
||||||
verbose = argument
|
verbose = argument
|
||||||
|
|
||||||
# argparse
|
# argparse
|
||||||
snippet addp
|
snippet addp
|
||||||
parser = ${VISUAL:argparse.}ArgumentParser()
|
parser = ${VISUAL:argparse.}ArgumentParser()
|
||||||
|
@ -279,7 +324,7 @@ snippet epydoc
|
||||||
"""
|
"""
|
||||||
snippet dol
|
snippet dol
|
||||||
def ${1:__init__}(self, *args, **kwargs):
|
def ${1:__init__}(self, *args, **kwargs):
|
||||||
super(${0:ClassName}, self).$1(*args, **kwargs)
|
super(${0:ClassName}, self).$1(*args, **kwargs)
|
||||||
snippet kwg
|
snippet kwg
|
||||||
self.${1:var_name} = kwargs.get('$1', ${2:None})
|
self.${1:var_name} = kwargs.get('$1', ${2:None})
|
||||||
snippet lkwg
|
snippet lkwg
|
||||||
|
|
|
@ -63,7 +63,7 @@ snippet eq equation environment
|
||||||
snippet eql Labeled equation environment
|
snippet eql Labeled equation environment
|
||||||
\\begin{equation}
|
\\begin{equation}
|
||||||
\\label{eq:${2}}
|
\\label{eq:${2}}
|
||||||
${0:${VISUAL}}
|
${0:${VISUAL}}
|
||||||
\\end{equation}
|
\\end{equation}
|
||||||
# Equation
|
# Equation
|
||||||
snippet eq* unnumbered equation environment
|
snippet eq* unnumbered equation environment
|
||||||
|
@ -406,6 +406,10 @@ snippet ddot ddot
|
||||||
snippet vec vector
|
snippet vec vector
|
||||||
\\vec{{$1}} {$0}
|
\\vec{{$1}} {$0}
|
||||||
|
|
||||||
|
# Bar
|
||||||
|
snippet bar bar
|
||||||
|
\\bar{{$1}} {$0}
|
||||||
|
|
||||||
# Cross product
|
# Cross product
|
||||||
snippet \x cross product
|
snippet \x cross product
|
||||||
\\times {$0}
|
\\times {$0}
|
||||||
|
|
Loading…
Reference in a new issue