-
Notifications
You must be signed in to change notification settings - Fork 106
fix: signature help spam by caching active parameter #1220
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
base: main
Are you sure you want to change the base?
fix: signature help spam by caching active parameter #1220
Conversation
client/src/main/scala/org/scastie/client/components/editor/MetalsSignatureHelp.scala
Outdated
Show resolved
Hide resolved
| cmState.StateField.define(js.Dynamic.literal( | ||
| create = (state: EditorState) => getSignatureTooltips(state), | ||
|
|
||
| update = (tooltips: js.Array[Tooltip], tr: Transaction) => { |
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.
The PR looks good and we can merge it but the current solution looks like could be greatly simplified just by adding check here pseudocode:
if (tr.changedText.contains("(",")"....) then getSignatureTooltips(tr.state) else tooltipsThere 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.
Do you mind checking if that is the case ? If not let me know and we will merge current solution
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.
Yeah, the current solution needs to be changed imo. I'm working on one.
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.
Do you mind checking if that is the case ? If not let me know and we will merge current solution
Ok, I'll check if that's the case.
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.
Did it work ? I like the current solution but parsing them seems like and overkill
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 can't remember exactly, but I do recall, that afaik it did not fix the underlying problem of the previous solution. It didn't work well with the nested braces. But I can test it again if you want - just to be sure.
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.
Ah now I remember what was the problem. This solution doesn't work well with nested brackets. Another issue was that it would not display signatureHelp when moving text cursor without actually inserting brackets.
d8435fb to
2595ee1
Compare
Summary
Fixes excessive signature help requests by implementing caching of the active parameter index.