fatih / vim-go

Go development plugin for Vim
https://www.patreon.com/bhcleek
Other
15.9k stars 1.45k forks source link

Support quoting arguments to :GoImpl #3632

Closed paddycarver closed 5 months ago

paddycarver commented 5 months ago

impl just got support for stubbing out methods on types with type parameters, but if there are multiple type parameters on a type, vim-go can't parse the command correctly. The space between type parameters confuses it, because it thinks an interface type shouldn't have any spaces in it.

I've found that if I add the ability to quote the interface type, it works as expected. I can upload a patch as a PR, but I must admit I'm not very experienced with vimscript and so the patch I've been using is probably hacky and naive.

What did you do? (required: The issue will be closed when not provided)

:GoImpl f Foo impractical.co/genhttp.Handler[myRequest, myResponse] with my cursor on the following code:

type Foo struct{}

What did you expect to happen?

For the methods of that interface to be stubbed out for me.

What happened instead?

vim-go: invalid receiver: "f Foo impractical.co/genhttp.Handler[myRequest,"

Configuration (MUST fill this out):

I'm sorry, I don't know what this means.

vim-go version:

1401b576c6ac382529188d3d26cff866139f2f9a

vimrc you used to reproduce:

vimrc This happens with every vimrc

Vim version (first three lines from :version):

NVIM v0.9.4 Build type: Release LuaJIT 2.1.1699801871

Go version (go version):

1.21.5, but happens on every version

Go environment

go env Output:

happens in every Go env

gopls version

gopls version Output:

happens with every gopls
bhcleek commented 5 months ago

Feel free to submit the patch in a PR. I'll review and we can figure out how to proceed from there.

bhcleek commented 5 months ago

@paddycarver I think vim-go doesn't need any changes here. If you'll use a backslash escape on the space, I think you'll have what you expect.

refs:

paddycarver commented 5 months ago

Well, I feel foolish! I could've sworn I had tried everything, and here I've been manually applying a patch for the last year. 😳

Thank you for the pointer, and sorry for the unnecessary issue.