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

coverage.vim: pass along arguments to coverage_job #1326

Merged
merged 1 commit into from
Jun 9, 2017
Merged
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
2 changes: 1 addition & 1 deletion autoload/go/coverage.vim
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function! go#coverage#Buffer(bang, ...) abort

if go#util#has_job()
call s:coverage_job({
\ 'cmd': ['go', 'test', '-coverprofile', l:tmpname],
\ 'cmd': ['go', 'test', '-coverprofile', l:tmpname] + a:000,
Copy link
Owner

Choose a reason for hiding this comment

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

What if I don't pass anything? What is the value of a:000? How does coverage look like for a single function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the first vimscript I've written.

a:000 is '[]' by default:

:breakadd func 24 go#coverage#Buffer
:debug GoCoverage

>cont
Breakpoint in "go#coverage#Buffer" line 24
function go#coverage#Buffer
line 24: if go#util#has_job()
>echo a:000
[]
>n
function go#coverage#Buffer
line 25: call s:coverage_job({ 'cmd': ['go', 'test', '-coverprofile', l:tmpname] + a:000, 'custom_cb': function('s:coverage_callback', [l:tmpname]), 'bang': a:bang, })
>echo ['go', 'test', '-coverprofile', l:tmpname] + a:000
['go', 'test', '-coverprofile', '/var/folders/3j/pjbjsn3x5vjf20fl1qb_q8z00000gn/T/vuMXJDi/78']
>echo ['go', 'test', '-coverprofile', l:tmpname]
['go', 'test', '-coverprofile', '/var/folders/3j/pjbjsn3x5vjf20fl1qb_q8z00000gn/T/vuMXJDi/78']
>echo a:000
[]
>

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks, and how does it look like inside Vim ? Can you add a screenshot?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Visually it looks the same as :GoCoverage -- it will instead only show lines covered by the particular test(s) run.

\ 'custom_cb': function('s:coverage_callback', [l:tmpname]),
\ 'bang': a:bang,
\ })
Expand Down