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

:GoImpl completion seems to break after an error #1554

Closed
arp242 opened this issue Nov 3, 2017 · 4 comments · Fixed by #1581
Closed

:GoImpl completion seems to break after an error #1554

arp242 opened this issue Nov 3, 2017 · 4 comments · Fixed by #1581
Assignees
Labels

Comments

@arp242
Copy link
Contributor

arp242 commented Nov 3, 2017

:GoImpl <Tab>
[completes as expected]
:GoImpl asd
vim-go: unrecognized interface: asd
:GoImpl <Tab>
[nothing happens]
:w
:GoImpl <Tab>
[completes as expected]

(While editing middleware/auditMiddleware/audit_test.go; I'll investigate later).

@arp242 arp242 added the bug label Nov 3, 2017
@arp242 arp242 self-assigned this Nov 3, 2017
@jeffwillette
Copy link
Contributor

This is my first time trying to user :GoImpl but I cannot get it to work with anything. if I call it with the args :GoImpl 'f *Foo' io.Reader I get this error...

vim-go: impl <recv> <iface>
vim-go:
vim-go: impl generates method stubs for recv to implement iface.
vim-go:
vim-go: Examples:
vim-go:
vim-go: impl 'f *File' io.Reader
vim-go: impl Murmur hash.Hash
vim-go:
vim-go: Don't forget the single quotes around the receiver type
vim-go: to prevent shell globbing.

if I call it and hit enter and type in io.Reader at the prompt I get the same error

@arp242
Copy link
Contributor Author

arp242 commented Nov 9, 2017

You shouldn't add quotes @deltaskelta; this should work:

:GoImpl f *Foo io.Reader

The quotes are in the help because guru assumes you're running it from a shell, in which case you need it to prevent shell globbing.

It's unrelated to this issue, but we should perhaps consider removing quotes for easier usage.

@jeffwillette
Copy link
Contributor

actually I still get the error when I do that which is what led me to put the quotes there in the first place. I can open an issue if you think this is still unrelated though...I am not too familiar with the internals of how its being called

@arp242
Copy link
Contributor Author

arp242 commented Nov 9, 2017

Yes please @deltaskelta; then we also have all information about your Vim version etc.

The command as such works fine for me, it's just the tab-completion that occasionally breaks for me.

arp242 added a commit that referenced this issue Nov 25, 2017
Fixes #1554

The problem is that `:GoImpl somethingInvalid` would set
`v:shell_error`, and on the next `:GoImpl <Tab>` the `go#util#env()`
call in `s:root_dirs()` would use the cache, so the `v:shell_error` is
"stuck".

Fix it by not checking this here; `go#util#env()` already shows an error
so that should be fine.

Long-term fix is to use `go#util#Exec()` everywhere which returns
`v:shell_error` instead of relying on a global value.

While I'm here also add a basic test and use `Exec()` in a few places.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants