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

Proposal: Note that VS Code and GoLand have provided “inlay hints” that can avoid naked parameters #166

Open
pan93412 opened this issue Feb 2, 2023 · 3 comments

Comments

@pan93412
Copy link
Contributor

pan93412 commented Feb 2, 2023

Related part: https://github.com/uber-go/guide/blob/master/style.md#avoid-naked-parameters

Both VS Code (with Go extension) and GoLand have provided “inlay hints” that can show every parameters name:

image

image

I wonder if we can add a section mentioning this feature to give the newer codebase another choice – no need to write such a hint explicitly? This feature makes us no longer need to write C-style comments anymore, since maintaining a separate comment can be easily out-of-sync with the original parameter name, and writing such a comment is a bit uninteresting for this IDE era, I think.

@alxn
Copy link
Member

alxn commented Feb 2, 2023

I don't believe these hints work in sourcegraph or other source code viewers ?

@prashantv
Copy link
Contributor

One place where the parameter information is useful is code reviews, and unfortunately this sort of overlay isn't available in the major review tools.

@sywhang
Copy link
Contributor

sywhang commented Feb 2, 2023

These hints also won't work on other editors like vim/neovim/etc. Last time I checked Go developer survey, there's still a nontrivial number of these users (over 20%, IIRC).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants