Marco Liberati
|
fb19e57a4e
|
[ES|QL] New @kbn/esql-services package (#179029)
## Summary
Closes https://github.com/elastic/kibana/issues/172649
This PR extracts the ES|QL service like "validation", "autocomplete",
"code_action" (quick fixes) and some other services into a separate
package `@kbn/esql-validation-autocomplete` which has no tie with Monaco
editor anymore.
All the AST and grammar logic has been encapsulated into a single
`@kbn/esql-ast` package who contains the `getAst` function together with
the `parser` and `lexer`.
## Validation enhancements
The validation API has been enhanced to gracefully degrade whenever
callbacks are not provided, via the `ignoreOnMissingCallback` option.
Tests are included as well for this scenario.
### Example plugin
An example plugin app has been developed to show to to use the
validation API
<img width="500" alt="Screenshot 2024-03-22 at 17 45 38"
src="ebc172d3 -ee61-4f3a-9e42-dcb9b15c7e69">
The app starts with a missing callback:
<img width="855" alt="Screenshot 2024-03-22 at 17 36 22"
src="c9b81370 -8a10-487d-b22f-2359e1365a54">
Toggling the ignore option will hide the index error due to the lack of
`getSources` callback:
<img width="816" alt="Screenshot 2024-03-22 at 17 28 17"
src="931f4e5f -3ad6-46f7-97ca-63d7bb66646b">
Warnings are shown as well when detected:
<img width="807" alt="Screenshot 2024-03-22 at 17 35 56"
src="5e3e0537 -cba2-475f-946b-0302867384ca">
#### Code snippet
The example app produces a copyable code snippet of the current
configuration of the validator:

### Checklist
- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [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 <42973632+kibanamachine@users.noreply.github.com>
|
2024-03-27 14:39:48 +01:00 |
|