Skip to content

Commit

Permalink
Merge pull request #910 from fatih/def-modified-file
Browse files Browse the repository at this point in the history
def: support modified files
  • Loading branch information
fatih authored Jun 23, 2016
2 parents b12fd9b + 336e3b0 commit 1e9590d
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 1e9590d

Please sign in to comment.