Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd, jobcontrol: add progress and complete message for nvim #695

Merged
merged 1 commit into from
Jan 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions autoload/go/cmd.vim
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function! go#cmd#autowrite()
endfunction


" Build buils the source code without producting any output binary. We live in
" Build builds the source code without producting any output binary. We live in
" an editor so the best is to build it to catch errors and fix them. By
" default it tries to call simply 'go build', but it first tries to get all
" dependent files for the current folder and passes it to go build.
Expand All @@ -27,6 +27,7 @@ function! go#cmd#Build(bang, ...)

" if we have nvim, call it asynchronously and return early ;)
if has('nvim')
call go#util#EchoProgress("building dispatched ...")
call go#jobcontrol#Spawn(a:bang, "build", args)
return
endif
Expand Down Expand Up @@ -183,14 +184,19 @@ function! go#cmd#Test(bang, compile, ...)
" expand all wildcards(i.e: '%' to the current file name)
let goargs = map(copy(a:000), "expand(v:val)")

" escape all shell arguments before we pass it to test
call extend(args, go#util#Shelllist(goargs, 1))
call extend(args, goargs, 1)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changed here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that a recent change 579dd89 broke go#cmd#GoTestFunc because go#util#Shelllist also escapes "-run" flag.
GoTestFunc passes goargs that contains "-run=TestABC" but go#util#Shelllist escapes that flag.

else
" only add this if no custom flags are passed
let timeout = get(g:, 'go_test_timeout', '10s')
call add(args, printf("-timeout=%s", timeout))
endif

if a:compile
echon "vim-go: " | echohl Identifier | echon "compiling tests ..." | echohl None
else
echon "vim-go: " | echohl Identifier | echon "testing ..." | echohl None
endif

if has('nvim')
if get(g:, 'go_term_enabled', 0)
call go#term#new(a:bang, ["go"] + args)
Expand All @@ -200,12 +206,6 @@ function! go#cmd#Test(bang, compile, ...)
return
endif

if a:compile
echon "vim-go: " | echohl Identifier | echon "compiling tests ..." | echohl None
else
echon "vim-go: " | echohl Identifier | echon "testing ..." | echohl None
endif

call go#cmd#autowrite()
redraw

Expand Down
2 changes: 2 additions & 0 deletions autoload/go/jobcontrol.vim
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ function! s:on_exit(job_id, exit_status)
call go#list#Window()

let self.state = "SUCCESS"
call go#util#EchoSuccess("SUCCESS")
return
endif

let self.state = "FAILED"
call go#util#EchoError("FAILED")

let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
let dir = getcwd()
Expand Down
2 changes: 1 addition & 1 deletion autoload/go/term.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let s:jobs = {}
" new creates a new terminal with the given command. Mode is set based on the
" global variable g:go_term_mode, which is by default set to :vsplit
function! go#term#new(bang, cmd)
call go#term#newmode(a:bang, a:cmd, g:go_term_mode)
return go#term#newmode(a:bang, a:cmd, g:go_term_mode)
endfunction

" new creates a new terminal with the given command and window mode.
Expand Down
2 changes: 1 addition & 1 deletion autoload/go/util.vim
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function! go#util#Shelljoin(arglist, ...)
endtry
endfunction

" Shelljoin 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.
function! go#util#Shelllist(arglist, ...)
try
Expand Down