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

x/tools/gopls: Add if not nil postfix snippet #61763

Closed
nchengyeeshen opened this issue Aug 4, 2023 · 4 comments
Closed

x/tools/gopls: Add if not nil postfix snippet #61763

nchengyeeshen opened this issue Aug 4, 2023 · 4 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. help wanted Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@nchengyeeshen
Copy link

I am taking inspiration from GoLand's postfix completions.

Given a nil-able expression, expr, .nn would help expand it to expr != nil.

Before:

package foo

func _() {
	var foo func()
	if foo.nn
}

After:

package foo

func _() {
	var foo func()
	if foo != nil
}

Here is what the postfix snippet will look like.
image

@nchengyeeshen nchengyeeshen added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Aug 4, 2023
@gopherbot gopherbot added this to the Unreleased milestone Aug 4, 2023
@findleyr
Copy link
Contributor

findleyr commented Aug 8, 2023

Sure, that makes sense to me.

Marking as help wanted.

@nchengyeeshen
Copy link
Author

@findleyr
Copy link
Contributor

findleyr commented Aug 8, 2023

Thanks, I'll review!

@gopherbot
Copy link

Change https://go.dev/cl/516015 mentions this issue: gopls: Add nn postfix snippet

@nchengyeeshen nchengyeeshen changed the title x/tools/gopls: Add not nil postfix snippet x/tools/gopls: Add if not nil postfix snippet Aug 15, 2023
@findleyr findleyr modified the milestones: gopls/backlog, gopls/v0.14.0 Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. help wanted Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants