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

allow :GoDoc on modified buffers #1014

Merged
merged 2 commits into from
Aug 27, 2016
Merged
Changes from 1 commit
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
15 changes: 13 additions & 2 deletions autoload/go/doc.vim
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,32 @@ function! go#doc#Open(newmode, mode, ...)
endif

let command = printf("%s %s", bin_path, join(a:000, ' '))
let out = go#util#System(command)
else
" check if we have 'gogetdoc' and use it automatically
let bin_path = go#path#CheckBinPath('gogetdoc')
if empty(bin_path)
return
endif


Copy link
Owner

Choose a reason for hiding this comment

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

Can you remove this additional newline

let offset = go#util#OffsetCursor()
let fname = expand("%:p:gs!\\!/!")
let pos = shellescape(fname.':#'.offset)

let command = printf("%s -pos %s", bin_path, pos)
let in = ""

if &modified
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add a comment above this variable to indicate the gogetdoc has a feature that we can make use of

let sep = go#util#LineEnding()
let content = join(getline(1, '$'), sep )
Copy link
Owner

Choose a reason for hiding this comment

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

Can you remove the whitespace after sep

let in = fname . "\n" . strlen(content) . "\n" . content
let command .= " -modified"
let out = go#util#System(command, in)
else
let out = go#util#System(command)
endif
endif

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