-
Notifications
You must be signed in to change notification settings - Fork 645
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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @fatih
@@ -117,6 +118,10 @@ export function activate(ctx: vscode.ExtensionContext): void { | |||
removeTags(args); | |||
})); | |||
|
|||
ctx.subscriptions.push(vscode.commands.registerCommand('go.impl.cursor', () => { | |||
implCursor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I registered the command to a key command in keybindings.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! thought so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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