-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add parameter dialog doesn't work when query has selected text #4032
Conversation
Dug around this a bit. The issue originates when a selection is made and a parameter is added, and in that case the Ace editor's Each of these signals is caught and subsequently causes For example, for this query: SELECT * FROM users WHERE id=5 If you select the "5" and create an "id" number parameter using the dialog, Ace editor will signal 2 changes: SELECT * FROM users WHERE id= and SELECT * FROM users WHERE id={{id}} The first signal will blank the query parameters (due to A simple workaround for this would be to simply insert the parameter fragment (instead of replacing the selection) when a selection is made. |
Would debouncing parseQuery work? |
We'd have to debounce a higher function, because I actually tried this with the source view's I'm a little concerned of edge cases so I'm going to submit this as a PR and would appreciate any thoughts on where this might fudge things up. |
…s failing parseQuery (see #4032)
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.
👍
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 approve the PR 😅 (I guess it's because I initially created the issue and now the issue is a PR). In any case, LGTM! :) |
…dash#4032) * debounce updateQuery to prevent pasting parameters over selected texts failing parseQuery (see getredash#4032) * drop defer
Issue Summary
Adding a parameter through the Parameter settings dialog won't work when you have a selected text in the query (parameter is added without any settings):
This is definitively not critical, but I thought it was worth to report in any case.
Steps to Reproduce
Ctrl/Cmd+P
Technical details: