-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Mark recursive references in let bindings #2902
Comments
This is a cool idea. I'm not sure how we'd do it, though. Semantic highlighting, maybe? But we'd need a special token modifier, and I don't think it's easy to get that to work 🤔 |
We can use hie to get the recursive relation. Semantic highlighting looks very suitable, but needs some extra work indeed to adapt recursive definition. Maybe we can do it after we have the support of semantic highlighting. |
How about diagnostic with |
I guess it could be a diagnostic. It feels noisy to put this information in there: it's going to clutter up people's diagnostic lists, and it's only something you care about occasionally, so that feels kind of bad? |
Yes, |
@sloorush one to think about when we're thinking about semantic highlighting. |
cc @soulomoon , although I don't think there's a good token modifier for this, sadly. |
For the direct recursive case, it should be easy |
It's also not clear that there is any appropriate type or modifier to use here. |
Is your feature request related to a problem? Please describe.
I just spent an hour debugging a hanging test, doubting my production code instead of checking the test code 🤦. If the recursive reference were highlighted, I would have found the mistake while writing the code.
For context, here's how it looked:
Describe the solution you'd like
Highlight recursive references with
let
exprs andlet
statements. I expect such a highlight to help with code understanding as well.Recursive references usually aren't mistakes, so the highlight should use a neutral style. Maybe underline it?
Ideally, the analysis also finds more indirect examples:
I suppose mutually recursive functions would also be highlighted by such an analysis. I don't know if this is desirable.
Describe alternatives you've considered
Build a cabin in the woods and earn with AirBnB.
Add non-recursive
let
to the language and change habits to use that instead. Keep making mistakes in library code that refuses to use it for compatibility reasons.Additional context
The text was updated successfully, but these errors were encountered: