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

Don't flag valid identifiers as misspelled in doc comments #329

Open
sdankel opened this issue May 8, 2024 · 1 comment
Open

Don't flag valid identifiers as misspelled in doc comments #329

sdankel opened this issue May 8, 2024 · 1 comment

Comments

@sdankel
Copy link

sdankel commented May 8, 2024

Is your feature request related to a particular use-case?

I tried this out, hoping to fix a bunch of typos in doc comments in my repo. However, there are thousands of errors everywhere that I have a comment with an valid identifier, for example:

/// A [HashMap] that can hold multiple values and ...

image

A possible workaround for now is using the regex transform to ignore anything inside of square brackets, but I haven't been able to get it to work. I think it should be a built-in option since it is conventional to use square brackets around types in rust doc comments for features like hover documentation.

Describe the solution you'd like to implement/see implemented

Ideally I wouldn't have to ignore everything inside of square brackets, as the parser could tell if the identifier is a valid name or not.

If you have any suggestions about the regex transform, it would be much appreciated!

Describe alternatives you've considered

Use a different spell checker

@drahnr
Copy link
Owner

drahnr commented May 9, 2024

Hey, thank you for flagging. Commonly I'd expect any inline code or types to be enclosed in back ticks, this includes linkage i.e.

Fred [`HashMap`] ghji.

And that works both for both, intra doc linkage as well as spell checking.

If you want to implement the collection of all types and doing a prefix tree match against [] enclosed strings, happy to help, it's by no means a trivial endavour to do it efficiently beyond a single file scope, and a single file scope would break due to wildcard imports.

tl;dr using [Foo] works, doing a special case impl is quite a bit of work and not necessary

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

No branches or pull requests

2 participants