-
-
Notifications
You must be signed in to change notification settings - Fork 202
Tweaks to Trivia::findNodeWhereRangeFitsIn #3169
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,12 +158,9 @@ let rec findNodeWhereRangeFitsIn (root: Node) (range: range) : Node option = | |
| // The more specific the node fits the selection, the better | ||
| let betterChildNode = | ||
| root.Children | ||
| |> Array.choose (fun childNode -> findNodeWhereRangeFitsIn childNode range) | ||
| |> Array.tryHead | ||
| |> Array.tryPick (fun childNode -> findNodeWhereRangeFitsIn childNode range) | ||
|
|
||
| match betterChildNode with | ||
| | Some betterChild -> Some betterChild | ||
| | None -> Some root | ||
| betterChildNode |> Option.orElseWith (fun () -> Some root) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think that would perform better? Or this is more of a "I would have written it that way" thing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why are you getting that from? The before and after seem rather close? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, thanks for sharing! |
||
|
|
||
| let triviaBeforeOrAfterEntireTree (rootNode: Node) (trivia: TriviaNode) : unit = | ||
| let isBefore = trivia.Range.EndLine < rootNode.Range.StartLine | ||
|
|
||


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 is the real improvement, is it not?