Skip to content
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

[ES|QL] open the suggestion menu automatically in more places #189585

Merged
merged 22 commits into from
Aug 7, 2024

Conversation

drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Jul 30, 2024

Summary

Closes #189662

Before

Screen.Recording.2024-07-30.at.4.51.29.PM.mov

After

Screen.Recording.2024-07-30.at.4.50.45.PM.mov
Before After
Source command
Pipe command
Function argument (when the minimum args aren't met)
Pipe |
Assignment var0 =
FROM source
FROM source METADATA
FROM source METADATA field
FROM source METADATA field,
EVAL argument
DISSECT field
DISSECT field pattern
DISSECT field pattern APPEND_SEPARATOR
DISSECT field pattern APPEND_SEPARATOR = separator
DROP field
DROP field1, field2
ENRICH policy
ENRICH policy ON
ENRICH policy ON field
ENRICH policy WITH
ENRICH policy WITH field
GROK field
GROK field pattern
KEEP field
KEEP field1, field2
LIMIT number
MV_EXPAND field
RENAME field
RENAME field AS
RENAME field AS var0
SORT field
SORT field order
SORT field order nulls-order
STATS argument
STATS argument BY
STATS argument BY expression
WHERE argument
WHERE argument comparison
WHERE argument comparison argument

Also made a couple of improvements

  • Added support for Invoke completion triggers for subsequent function arguments (e.g. date_diff("day", <cursor here>))
  • When you select a date in the date picker, your cursor is now advanced past the inserted date and the editor is refocused.

Checklist

@drewdaemon
Copy link
Contributor Author

/ci

@drewdaemon drewdaemon changed the title [ES|QL] add some smoother autocompletion [ES|QL] open the suggestion menu automatically where possible Jul 31, 2024
@drewdaemon drewdaemon added Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana labels Aug 5, 2024
@drewdaemon
Copy link
Contributor Author

/ci

@drewdaemon drewdaemon marked this pull request as ready for review August 6, 2024 03:44
@drewdaemon drewdaemon requested a review from a team as a code owner August 6, 2024 03:44
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@drewdaemon drewdaemon requested a review from ryankeairns August 6, 2024 03:45
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is awesome, improves the experience A LOT!

Something seems to be broken though

image

Here I am expecting the named params and the date picker to be suggested and they are not. This is how it looks in main
image


type GetSourceFn = () => Promise<SuggestionRawDefinition[]>;
type GetDataStreamsForIntegrationFn = (
sourceName: string
) => Promise<Array<{ name: string; title?: string }> | undefined>;
type GetFieldsByTypeFn = (
type: string | string[],
ignored?: string[]
ignored?: string[],
options?: { advanceCursorAndOpenSuggestions?: boolean; addComma?: boolean }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is hard but this is a very nice variable name!

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MUCH smoother. This rounds off some sharp edges and left me feeling like I got to a result much more quickly. Great update!

@drewdaemon
Copy link
Contributor Author

/ci

@drewdaemon
Copy link
Contributor Author

@stratoula I fixed that bug and added a test so that it doesn't happen again!

@drewdaemon drewdaemon changed the title [ES|QL] open the suggestion menu automatically where possible [ES|QL] open the suggestion menu automatically in more places Aug 6, 2024
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
esql 173.3KB 173.5KB +242.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 3.3MB 3.3MB +1.0KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome Drew, thanx a ton. Great enhancement!

More ideas that we could explore:

  • If the user selects an index and then comma, we could immediately open again the sources suggestions
  • Similar with keep, if the user selects a field, then open the suggestions menu to select comma and then again fields etc. I am anticipating that the keep command will be quite popular

My suggestions are just ideas we could explore in another PR or at some other time. I am approving, this is great as it is already!

@drewdaemon drewdaemon merged commit 44c5f8c into elastic:main Aug 7, 2024
19 checks passed
@kibanamachine kibanamachine added v8.16.0 backport:skip This commit does not require backporting labels Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:ES|QL ES|QL related features in Kibana release_note:enhancement Team:ESQL ES|QL related features in Kibana v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ES|QL] menu should open again automatically when users accept suggestions
6 participants