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

def: support modified files #910

Merged
merged 1 commit into from
Jun 23, 2016
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
10 changes: 10 additions & 0 deletions autoload/go/def.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ function! go#def#Jump(mode)
let $GOPATH = go#path#Detect()

let fname = fnamemodify(expand("%"), ':p:gs?\\?/?')
if &modified
" Write current unsaved buffer to a temp file and use the modified content
let l:tmpname = tempname()
call writefile(getline(1, '$'), l:tmpname)
let fname = l:tmpname
endif

" so guru right now is slow for some people. previously we were using
" godef which also has it's own quirks. But this issue come up so many
Expand Down Expand Up @@ -46,6 +52,10 @@ function! go#def#Jump(mode)
return
endif

if exists("l:tmpname")
call delete(l:tmpname)
endif

if go#util#ShellError() != 0
call go#util#EchoError(out)
return
Expand Down