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

Add support of g:go_doc_command and g:go_doc_options parameters #1420

Merged
merged 6 commits into from
Sep 7, 2017
Merged

Add support of g:go_doc_command and g:go_doc_options parameters #1420

merged 6 commits into from
Sep 7, 2017

Conversation

nk2ge5k
Copy link
Contributor

@nk2ge5k nk2ge5k commented Aug 29, 2017

No description provided.

@arp242
Copy link
Contributor

arp242 commented Aug 29, 2017

Personally I think it might be a good idea store this as a list, instead of two separate options:

g:go_doc_command = ["godoc"]

You can then set this to ["go", "doc"].

Or perhaps even store all commands as a dict, instead of many options:

g:go_commands = {
    \ "go": ["go"],
    \ "godoc": ["godoc"],
    \ "gometalinter": ["gometalinter"],
    " ..etc..   
\}

I don't know what Fatih thinks, though.

@fatih
Copy link
Owner

fatih commented Aug 30, 2017

Yeah, a list is better. We can then join later. For go_commands I think that's something we can tackle later as it'll require a lot of work, don't want to add it now at least.

@nk2ge5k
Copy link
Contributor Author

nk2ge5k commented Sep 4, 2017

Sorry for delay.
I made g:go_doc_command type of list and removed g:go_doc_options. Hope its better now.

return
endif

let command = printf("%s %s", go#util#Shellescape(bin_path), join(a:000, ' '))
let command = printf("%s %s", join(g:go_doc_command, ' '), join(a:000, ' '))
Copy link
Contributor

Choose a reason for hiding this comment

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

This removes the go#util#Shellescape() part. You should probably map that to every entry in g:go_doc_command?

(This should probably be done by the System() function, but changing that would require careful testing of all the System() invocations and may break people's configs).

@arp242
Copy link
Contributor

arp242 commented Sep 6, 2017

Seems to work well in my testing, but there is a caveats with this: the go_doc_command setting is only used when invoked as :GoDoc packagename. If you use :GoDoc or K to get the documentation under the cursor, vim-go will always use gogetdoc.

It would be good to update the documentation as well, because this confused me rather a lot and it took me a trip to the source code to figure out why setting g:go_doc_command doesn't work.

Currently it reads:

Use this option to define which tool is used to godoc. By default `godoc` is
used

IMHO something like this would be better:

Command to use for |:GoDoc|; only used when it's invoked with a package
name. The `gogetdoc` command is always used when |:GoDoc| is used to get the
documentation of the identifier under the cursor.

@arp242 arp242 merged commit 506ddaf into fatih:master Sep 7, 2017
@arp242
Copy link
Contributor

arp242 commented Sep 7, 2017

Thank you @nk2ge5k.

@nk2ge5k
Copy link
Contributor Author

nk2ge5k commented Sep 7, 2017

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants