Goimpl implementation#939
Goimpl implementation#939ramya-rao-a merged 4 commits intomicrosoft:masterfrom itsjamie:goimpl-implementation
Conversation
Does some basic input validation to ensure the required information is passed. The regex included makes the receiver name optional, the intention there is that if the receiver name isn't included, that the type the cursor is in should be used as the receiver for the interface. However, I think that the first step of just having the ability to use goimpl was a important first step.
|
@itsjamie, It will cover your contributions to all Microsoft-managed open source projects. |
|
Just waiting for DocuSign email regarding CLA request. |
|
@itsjamie, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
|
Hey @itsjamie, I've been meaning to look at this PR since a while, but I've been swamped this week. Thanks for your work! |
ramya-rao-a
left a comment
There was a problem hiding this comment.
Great start @itsjamie . Just added 2 thoughts on it, let me know what you think
| return; | ||
| } | ||
|
|
||
| // TODO: automatically detect type name at cursor |
There was a problem hiding this comment.
In this case, if you use the cursor to determine the type, then where would you propose to place the stub. End of the file?
There was a problem hiding this comment.
I was thinking of right after the type. So it would need some detection to find the first empty line after the type.
There was a problem hiding this comment.
@fatih Where does vim-go paste the stub while taking the identifier under the cursor as receiver? Am referring to https://github.com/fatih/vim-go/blob/master/doc/vim-go.txt#L665
There was a problem hiding this comment.
@ramya-rao-a currently it just places the generated stub under the cursor. It's not in place. There is an open PR that aims to fix it: josharian/impl#16
| })); | ||
|
|
||
| ctx.subscriptions.push(vscode.commands.registerCommand('go.impl.cursor', () => { | ||
| implCursor(); |
There was a problem hiding this comment.
You need to add this command in package.json as well, so that the command shows up in the command pallet.
Am curious, how did you test this without the command showing up in the command pallet?
There was a problem hiding this comment.
I registered the command to a key command in keybindings.json
There was a problem hiding this comment.
Added this to the package.json in commit b640cc3
|
waiting for this to be merged :) |
A start of the goimpl implementation, pretty simple feature as it exists right now, just pop open the info box, take the information and then inject the stdout at the cursor position.
I see a few ways it could be improved, but figure it was better to just get the simple implementation done.
Idea for improvement