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: check spelling of identifiers in declarations #71160

Open
adonovan opened this issue Jan 7, 2025 · 2 comments
Open

x/tools/gopls: check spelling of identifiers in declarations #71160

adonovan opened this issue Jan 7, 2025 · 2 comments
Labels
gopls/analysis Issues related to running analysis in gopls gopls Issues related to the Go language server, gopls.

Comments

@adonovan
Copy link
Member

adonovan commented Jan 7, 2025

It would be nice if gopls could reliably point out misspellings in declarations (but not in references, where it is just a nuisance), while being aware of Go conventions for capitalization, word breaking, and local project naming conventions. An analyzer seems like the easiest integration. (Semantic tokens doesn't have a "misspelled" modifier, nor the means to suggest a fix.)

One way to do this is to develop something from scratch, but I bet there are spell checkers out there that we could reuse. The tricky part will be to define a loosely coupled interface to avoid x/tools from having to add a dependency on them.

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Jan 7, 2025
@adonovan adonovan added gopls Issues related to the Go language server, gopls. and removed Tools This label describes issues relating to any tools in the x/tools repository. labels Jan 7, 2025
@gopherbot gopherbot added this to the Unreleased milestone Jan 7, 2025
@adonovan adonovan added the gopls/analysis Issues related to running analysis in gopls label Jan 7, 2025
@findleyr findleyr modified the milestones: Unreleased, gopls/unplanned Jan 8, 2025
@thediveo
Copy link
Contributor

thediveo commented Jan 8, 2025

There are already many linters and spell checkers with Go support out there.

Spell checkers are in my experience notoriously bad, especially when groaning over well-established domain terminology they beg to differ.

Then, there are enough situations where identifiers will follow rules outside the realm of Go (with the exception of exportability in some cases) and there forcing Go rules upon devs will cause devs to either not find the identifiers or consider Go as a policing tool they will then avoid for other languages that are not inflicting narrow rules.

This all creates unnecessary noise ... and that's exactly what devs don't need and don't want.

@adonovan
Copy link
Member Author

adonovan commented Jan 8, 2025

Thanks for the information. I agree we should not introduce this feature unless its false positive rate is very low. I wonder what is the state of the art of inferring the local conventions, respecting necessity (e.g. protoc-generated unconventional capitalizatons), etc. Seems like a machine learning (not specifically LLM) problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/analysis Issues related to running analysis in gopls gopls Issues related to the Go language server, gopls.
Projects
None yet
Development

No branches or pull requests

4 participants