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

Guru PointsTo #1751

Merged
merged 3 commits into from
Apr 4, 2018
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
## unplanned

## unplanned

FEATURES:

* Add `:GoPointsTo` to show all variables to which the pointer under the cursor
may point to.
[[GH-1751]](https://github.com/fatih/vim-go/pull/1751)

IMPROVEMENTS:

BUG FIXES:

BACKWARDS INCOMPATIBILITIES:

## 1.17 - (March 27, 2018)

FEATURES:
Expand Down
13 changes: 12 additions & 1 deletion autoload/go/guru.vim
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ function! s:async_guru(args) abort
return
endif


if !has_key(a:args, 'disable_progress')
if a:args.needs_scope
call go#util#EchoProgress("analysing with scope " . result.scope .
Expand Down Expand Up @@ -262,6 +261,18 @@ function! go#guru#Implements(selected) abort
call s:run_guru(args)
endfunction

" Shows the set of possible objects to which a pointer may point.
function! go#guru#PointsTo(selected) abort
let l:args = {
\ 'mode': 'pointsto',
\ 'format': 'plain',
\ 'selected': a:selected,
\ 'needs_scope': 1,
\ }

call s:run_guru(l:args)
endfunction

" Report the possible constants, global variables, and concrete types that may
" appear in a value of type error
function! go#guru#Whicherrs(selected) abort
Expand Down
10 changes: 10 additions & 0 deletions doc/vim-go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,12 @@ CTRL-t
\| command! -bang AS call go#alternate#Switch(<bang>0, 'split')
augroup END
<

*:GoPointsTo*
:GoPointsTo

Show all variables to which the pointer under the cursor may point to.

*:GoWhicherrs*
:GoWhicherrs

Expand Down Expand Up @@ -1030,6 +1036,10 @@ Show send/receive corresponding to selected channel op

Show all refs to entity denoted by selected identifier

*(go-pointsto)*

Show all variables to which the pointer under the cursor may point to.

*(go-metalinter)*

Calls `go-metalinter` for the current directory
Expand Down
1 change: 1 addition & 0 deletions ftplugin/go/commands.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ command! -nargs=? -complete=customlist,go#rename#Complete GoRename call go#renam
" -- guru
command! -nargs=* -complete=customlist,go#package#Complete GoGuruScope call go#guru#Scope(<f-args>)
command! -range=% GoImplements call go#guru#Implements(<count>)
command! -range=% GoPointsTo call go#guru#PointsTo(<count>)
command! -range=% GoWhicherrs call go#guru#Whicherrs(<count>)
command! -range=% GoCallees call go#guru#Callees(<count>)
command! -range=% GoDescribe call go#guru#Describe(<count>)
Expand Down
1 change: 1 addition & 0 deletions ftplugin/go/mappings.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ xnoremap <silent> <Plug>(go-freevars) :<C-u>call go#guru#Freevars(0)<CR>
nnoremap <silent> <Plug>(go-channelpeers) :<C-u>call go#guru#ChannelPeers(-1)<CR>
nnoremap <silent> <Plug>(go-referrers) :<C-u>call go#guru#Referrers(-1)<CR>
nnoremap <silent> <Plug>(go-sameids) :<C-u>call go#guru#SameIds()<CR>
nnoremap <silent> <Plug>(go-pointsto) :<C-u>call go#guru#PointsTo(-1)<CR>
nnoremap <silent> <Plug>(go-whicherrs) :<C-u>call go#guru#Whicherrs(-1)<CR>
nnoremap <silent> <Plug>(go-sameids-toggle) :<C-u>call go#guru#ToggleSameIds()<CR>

Expand Down