-
Notifications
You must be signed in to change notification settings - Fork 847
Filter type test completion list #12930
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
Conversation
| | SynExpr.Match (expr=synExpr; clauses=synMatchClauseList) -> | ||
| [yield dive synExpr synExpr.Range traverseSynExpr | ||
| yield! synMatchClauseList |> List.map (fun x -> dive x x.RangeOfGuardAndRhs (traverseSynMatchClause path))] | ||
| yield! synMatchClauseList |> List.map (fun x -> dive x x.Range (traverseSynMatchClause path))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know why RangeOfGuardAndRhs was used here. MatchLambda and TryWith traversals use Range, so this change seemed appropriate. Without it VisitPat is never fired in a match clause pattern, and so we don't get a chance to create the right completion context.
| match p with | ||
| | SynPat.Paren (p, _) -> traversePat path p | ||
| | SynPat.Or (p1, p2, _, _) -> [ p1; p2] |> List.tryPick (traversePat path) | ||
| | SynPat.As (p1, p2, _) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looked like an omission. I don't see why we wouldn't want to dive into both subpatterns here. Without it VisitPat is not fired for IsInst when the type test is paired with an as (which it very often is).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
completely agree with this logic
Given
pressing Ctrl-space on
strorArgwill now only show type-like completions. Currently the list also contains keywords and functions.