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

[ESQL] Improve the typing experience #144296

Closed
2 of 3 tasks
stratoula opened this issue Nov 1, 2022 · 3 comments
Closed
2 of 3 tasks

[ESQL] Improve the typing experience #144296

stratoula opened this issue Nov 1, 2022 · 3 comments
Assignees
Labels
enhancement New value added to drive a business result Feature:Unified search Unified search related tasks impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@stratoula
Copy link
Contributor

stratoula commented Nov 1, 2022

Describe the feature:
In order to improve the experience of our users with ESQL we would like to add the following features into our code editor (monaco)

  • Syntax parsing (antlr is a good choice here)

  • Autocomplete while typing (dataviews, fields, commands)

  • When we have the ES API _validate, we could also call it when the user stops typing to validate the query (as long as the syntax is correct)

@stratoula stratoula added enhancement New value added to drive a business result Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Unified search Unified search related tasks labels Nov 1, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors)

@stratoula
Copy link
Contributor Author

stratoula commented Nov 2, 2022

Commands that are going to be supported for the milestone 1 are:

  • from
  • stats ... (by ...)
  • eval
  • sort
  • limit
  • where

Aggregate Functions

  • max()
  • min()
  • sum()
  • avg()

Scalar Function

  • round()

Operators

  • = (equality)
  • / (division)
  • (+)
  • (-)

alexwizp added a commit that referenced this issue Dec 7, 2022
Part of: #144296

## Summary

First step of `[ESQL] Improve the typing experience` (#144296). This PR
is the skeleton for later parts, but already supports basic parsing
scenarios.

## What was done: 
- [x] Added new `ESQL` language in `@kbn/monaco` package. Parsing was
done using the `antl` syntax;
- [x] `kbnUiSharedDeps`-srcJs bundle has been optimised, all workers
have been moved into separate chunks. This gave almost minus` 2 MB` 🕺
- [x] existing `esql` lang was renamed to `sql`. In order not to confuse
anyone in the future
- [x] some code from `painless` folder was moved to `common` and reused
in ESQL (probably needs some refactoring in future)

## Next steps: 
- [ ]  improving `ANLT` syntax to cover all cases
- [ ]  implementing `Autocomplete` feature

## How to use new `ESQL Lang`:
To use new language 2 properties should be set for `CodeEditor`
component

```ts
import { ESQL_LANG_ID, ESQL_THEME_ID  } from '@kbn/monaco';
import { CodeEditor  } from '@kbn/kibana-react-plugin/public';

 <CodeEditor
      ...
      languageId={ESQL_LANG_ID}
      options={{
        ...
        theme: ESQL_THEME_ID,
      }}
 />
```

Currently syntax highlighting looks like: 

<img width="450" alt="image"
src="https://user-images.githubusercontent.com/20072247/205685072-0658fad1-d034-4d36-a44d-6a49e7365ab3.png">

<img width="450" alt="image"
src="https://user-images.githubusercontent.com/20072247/205685220-c67db50c-6f3b-49b5-9576-d1ee68428184.png">


Will be updated in Step 2

Co-authored-by: kibanamachine <[email protected]>
Co-authored-by: Marco Liberati <[email protected]>
@stratoula stratoula added impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:weeks labels Dec 20, 2022
@stratoula
Copy link
Contributor Author

Autocomplete for ESQL is done and merged to the feature branch, I am closing this for now as we achieved what we wanted for the first milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New value added to drive a business result Feature:Unified search Unified search related tasks impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

3 participants