-
Notifications
You must be signed in to change notification settings - Fork 180
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
feat(compass-editor, compass-query-bar): provide auto completed query history matching user input COMPASS-8018 #6040
feat(compass-editor, compass-query-bar): provide auto completed query history matching user input COMPASS-8018 #6040
Conversation
…completed-query-history-matching-user-input
packages/compass-editor/src/codemirror/query-history-autocompleter.ts
Outdated
Show resolved
Hide resolved
min: number, | ||
max: number | ||
): number { | ||
if (max === min) return 0; |
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 looks like unexpected input. returning a number could make such input go unnoticed, and 0 might be out of the allowed scale - so it would be safer to throw
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 returned 0 because in the context of the autocompleter, originalScaleMin = originalScaleMax only when there is 1 lastExecuted time, in which case it doesn't matter how the autocompleter ranks the completion. The boost
property in the options expects numbers between -99 and 99, so I could probably return any number between those.
For the sake of making the input noticed, do you think it would be a better idea to throw an error in the function and then catch the error within the autocompleter options itself instead of handling it in the function?
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.
Nice, left a comment or two on the recent changes. Looking good!
3509baa
to
e2cb578
Compare
…story-matching-user-input
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.
Nice tests! Code looks good, left a comment on what we're autocompleting. We might want to match a bit less than we currently do.
Description
COMPASS-8018
The query history autocompleter will still show up on focus but now users will also be able to type to match their input. The new autocompleter has 2 sections, with the original base completions for fields on the top and query history completions on the bottom (if any).
On focus:
Both types of completions:
Just saved queries:
Checklist
Motivation and Context
Open Questions
When a query is currently in an editor and the cursor is focused on it, pressing reset will trigger onFocus() for that particular editor and becomes unfocused after the {} and autocompleter are automatically triggered.
Dependents
COMPASS-8017
Types of changes