-
Notifications
You must be signed in to change notification settings - Fork 225
Migrate DocumentHighlight to Listener pattern #748
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
|
5028e4f to
91b11a7
Compare
|
I've rerun benchmark around 8 times and |
Since DocumentHighlight focuses on the type of the visited node instead of the visiting event, I think it makes sense to introduce a new `on_node` event for it. It saves us from expanding the nodes list in HighlightTarget into a list of fragmented `on_<node>` events. It should also benefit other requests that currently define the `visit` method.
|
Wrt the slowdown, I notice that it also happens to other migration PRs:
So it's likely not specific to this change. We should look into what's causing the slowdown though OR if our benchmark is too sensitive. |
| highlight_target = | ||
| case target | ||
| when *DIRECT_HIGHLIGHTS | ||
| Support::HighlightTarget.new(target) | ||
| when SyntaxTree::Ident | ||
| relevant_node = parent.is_a?(SyntaxTree::Params) ? target : parent | ||
| Support::HighlightTarget.new(relevant_node) | ||
| end |
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.
Not a blocker, but just a thought: what if we move this to Executor? Would that maybe simplify things a bit?
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.
Consider the data type it uses (HighlightTarget) is still specific to this request, I prefer keeping it at the same place until we share it somewhere else.
Time out tests that don't finish under 30 seconds
Since DocumentHighlight focuses on the type of the visited node instead of the visiting event, I think it makes sense to introduce a new
on_visitevent for it. It saves us from expanding the nodes list in HighlightTarget into a list of fragmentedon_<node>events.It should also benefit other requests that currently define the
visitmethod.Motivation
Implementation
Automated Tests
Manual Tests