Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ES|QL] Improve support for
Invoke
completion trigger kind (#188877)
## Summary Resolve #188677 This PR extends our support for Monaco's "Invoke" completion trigger kind ([ref](https://microsoft.github.io/monaco-editor/typedoc/enums/languages.CompletionTriggerKind.html)). What this means for the user is that suggestions are now shown when the user types a character in a word even if the suggestion menu isn't already open. This situation often occurs when the user is editing a query. For example, they may follow a flow like this: 1. `FROM my-index | LIMIT 10<cursor-here>` 2. `FROM <cursor-here> | LIMIT 10` (deleted the index name) 3. `FROM k<cursor-here> | LIMIT 10` (types the first character of the index name) Previously, they wouldn't get any help. Now, we show the list of suggestions. The following table shows the cases that I considered as well as the ones that are now fixed. I also added test coverage, even for cases that worked before to prevent subtle regressions. | | Before | After | |------------------------------|------------------------------------------|-----------------------| | Source command | ✅ | ✅ | | Pipe command | ❌ | ✅ | | Function argument | ✅ | ✅ | | FROM source | ❌ | ✅ | | FROM source METADATA | ✅ | ✅ | | FROM source METADATA field | ❌ (for `_`) | ✅ | | EVAL argument | ✅ | ✅ | | DISSECT field | ✅ | ✅ | | DISSECT field pattern | ❌ | ❌ | | 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 | ✅ | ✅ | As I worked, I encountered a couple small bugs which I also fixed. ### Escaping field values in `ENRICH` **Before** https://github.com/user-attachments/assets/88f2bf35-a703-4cf4-8d45-a24452a1b59d **After** https://github.com/user-attachments/assets/69ad0770-f158-44fb-be8d-66b497c7f7f7 ### Suggesting variable assignment in `ENRICH ... WITH` **Before** https://github.com/user-attachments/assets/fec47b6d-eae5-44e8-b739-9b2eecc7458b **After** https://github.com/user-attachments/assets/dff5afe1-37e7-470b-bb9c-edb5ac87e76d ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: kibanamachine <[email protected]> (cherry picked from commit c77cd80) # Conflicts: # packages/kbn-esql-validation-autocomplete/src/autocomplete/__tests__/autocomplete.command.stats.test.ts # packages/kbn-esql-validation-autocomplete/src/autocomplete/autocomplete.test.ts
- Loading branch information