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

Also select variable when using af on anonymous functions #1341

Closed
wants to merge 1 commit into from
Closed

Also select variable when using af on anonymous functions #1341

wants to merge 1 commit into from

Conversation

arp242
Copy link
Contributor

@arp242 arp242 commented Jun 30, 2017

When using af on an anonymous function that is assigned, such as:

peanuts := func(a string) error {
	return errors.New("I'm alergic!")
}

we will now also select the peanuts variable.

This could be improved by not assuming a single space between = and the
func. Dunno if that's worth the effort ... use gofmt? ;-)

Fixes: #1181

When using `af` on an anonymous function that is assigned, such as:

	peanuts := func(a string) error {
		return errors.New("I'm alergic!")
	}

we will now also select the `peanuts` variable.

This could be improved by not assuming a single space between `=` and the
`func`. Dunno if that's worth the effort ... use gofmt? ;-)

Fixes: #1181
@fatih
Copy link
Owner

fatih commented Jul 6, 2017

Hi @Carpetsmoker

This seems to be complicated. I've implemented a simpler version: #1345 what do you think? This is configurable, and second it works by using the existing information (only for one liners do we need to calculate the column number of the variable).

@arp242
Copy link
Contributor Author

arp242 commented Jul 10, 2017

Your solution is probably better @fatih. I'll close this. Thanks 👍

@arp242 arp242 closed this Jul 10, 2017
@arp242 arp242 deleted the af-assign branch September 10, 2017 07:14
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.

2 participants