-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: add type
to the hover for types
#41357
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
Comments
To be clear, this looks like a request for clearer Hover messages. Is that right? |
@pjweinb I think I described it a bit more precise then that :) In summary just don't remove example2: go doc http.HandlerFunc
in hover message you get
A person new to go thinks this compiler error message haha wrong its a type actually even worse you get too many arguments to conversion to http.HandlerFunc: http.HandlerFunc("a", "b") https://play.golang.org/p/NfpIDUr6teT New go user ??? ok I am going to stick to js instead, go is waaaay to confusing All I want to say is leaving out
|
I think the only case where a keyword is not present in the hover message is in the case of types, which is likely because of the way we format their hover. We can consider adding |
type
to the hover for types
@nasjp: Goland does not use |
Change https://golang.org/cl/260006 mentions this issue: |
For some reason tools beside go doc like to get rid of the keyword type for example, granted in most cases a experienced go developer instantly knows the symbol refers to a const, var, func or type. But in some cases especially this first one, it's very easily misunderstood that HandlerFunc is a type. For example the name contains Func and and the definition contains func, so it's very crustial to not leave out the word type in the beginning to not confuse people who are new to go. Yes type it's in the description at least but that just lucky somebody put it in the comment.
Fortunately func is always included, but that's not a excuse to drop type var const
go doc json
for example is very consistent in that regard making sure to always start with func type const or varThe text was updated successfully, but these errors were encountered: