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

[Backport 2.x] [Auto Suggest] DQL autosuggest with ANTLR #7590

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

opensearch-trigger-bot[bot]
Copy link
Contributor

Backport 2b1d01f from #7391.

* Antlr autocomplete (#7159)

* dql grammar with rudamentary testing parser

Signed-off-by: Paul Sebastian <[email protected]>

* show suggestion of fields depending on current index pattern

Signed-off-by: Paul Sebastian <[email protected]>

* basic code completion with fields populated

Signed-off-by: Paul Sebastian <[email protected]>

* updated grammar and generated for better group handling

Signed-off-by: Paul Sebastian <[email protected]>

* add ignored tokens

Signed-off-by: Paul Sebastian <[email protected]>

* remove console logs

Signed-off-by: Paul Sebastian <[email protected]>

---------

Signed-off-by: Paul Sebastian <[email protected]>

* dql Antlr autocomplete (#7160)

* re-add provider for sql

Signed-off-by: Paul Sebastian <[email protected]>

* added temporary fix for language providor to appear for more than one language

Signed-off-by: Paul Sebastian <[email protected]>

---------

Signed-off-by: Paul Sebastian <[email protected]>

* remove EOF in parser to fix suggestions

Signed-off-by: Paul Sebastian <[email protected]>

* use custom version of cursor token index for dql

Signed-off-by: Paul Sebastian <[email protected]>

* implemented value suggestions based on field

Signed-off-by: Paul Sebastian <[email protected]>

* set param type

Signed-off-by: Paul Sebastian <[email protected]>

* update grouping grammar

Signed-off-by: Paul Sebastian <[email protected]>

* fix grammar for dots in field and value term search with spaces

Signed-off-by: Paul Sebastian <[email protected]>

* value suggestions match field to avoid failing api call and to find assc keyword field

Signed-off-by: Paul Sebastian <[email protected]>

* update value suggestions from partially formed value

Signed-off-by: Paul Sebastian <[email protected]>

* refactor value suggestions and change fieldval listener to visitor

Signed-off-by: Paul Sebastian <[email protected]>

* implement value suggestions within phrases

Signed-off-by: Paul Sebastian <[email protected]>

* make grammar more readable

Signed-off-by: Paul Sebastian <[email protected]>

* rename grammar parser rules

Signed-off-by: Paul Sebastian <[email protected]>

* bring back minimal autocomplete optimized grammar

Signed-off-by: Paul Sebastian <[email protected]>

* enable partially complete value suggestion for value groups

Signed-off-by: Paul Sebastian <[email protected]>

* remove number as lexer rule

Signed-off-by: Paul Sebastian <[email protected]>

* fix cursor import and clean up

Signed-off-by: Paul Sebastian <[email protected]>

* fix completion item range to be current word

Signed-off-by: Paul Sebastian <[email protected]>

* update cursor to use monaco position

Signed-off-by: Paul Sebastian <[email protected]>

* cursor index to use position directly

Signed-off-by: Paul Sebastian <[email protected]>

* move language registration into render function to handle new languages

Signed-off-by: Paul Sebastian <[email protected]>

* include auto closing quotes and parenthesis for dql

Signed-off-by: Paul Sebastian <[email protected]>

* rename generated file

Signed-off-by: Paul Sebastian <[email protected]>

* Changeset file for PR #7391 created/updated

* add license and fix linting

Signed-off-by: Paul Sebastian <[email protected]>

* modify grammar

Signed-off-by: Paul Sebastian <[email protected]>

* add tests for fields and keywords

Signed-off-by: Paul Sebastian <[email protected]>

* move dql test constants to separate file

Signed-off-by: Paul Sebastian <[email protected]>

* pass core setup from autocomplete constructor to query sugg provider and utilize selectionEnd if no position

Signed-off-by: Paul Sebastian <[email protected]>

* update an import

Signed-off-by: Paul Sebastian <[email protected]>

* use updated dataset for index pattern

Signed-off-by: Paul Sebastian <[email protected]>

* remove console log

Signed-off-by: Paul Sebastian <[email protected]>

* [Auto Suggest] DQL Updates (#7498)

* update code completion to not return for visualize

Signed-off-by: Paul Sebastian <[email protected]>

* update types to match completionitemkind

Signed-off-by: Paul Sebastian <[email protected]>

---------

Signed-off-by: Paul Sebastian <[email protected]>

* update saved object test flyout snap

Signed-off-by: Paul Sebastian <[email protected]>

* update tests to match changes

Signed-off-by: Paul Sebastian <[email protected]>

* updated editor

Signed-off-by: Paul Sebastian <[email protected]>

* insert colon and space after selecting suggested field

Signed-off-by: Paul Sebastian <[email protected]>

* fix suggestions after colon without space

Signed-off-by: Paul Sebastian <[email protected]>

* update test

Signed-off-by: Paul Sebastian <[email protected]>

* typing update

Signed-off-by: Paul Sebastian <[email protected]>

* updated dataset name

Signed-off-by: Paul Sebastian <[email protected]>

* remove connection service based lines and rely on service

Signed-off-by: Paul Sebastian <[email protected]>

* add debouncer for index pattern calls

Signed-off-by: Paul Sebastian <[email protected]>

* use index pattern service rather than debounce

Signed-off-by: Paul Sebastian <[email protected]>

* update mock index for test

Signed-off-by: Paul Sebastian <[email protected]>

---------

Signed-off-by: Paul Sebastian <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 2b1d01f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Copy link
Contributor

❌ Invalid Changelog Heading

The '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax.

Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 58.68794% with 233 lines in your changes missing coverage. Please review.

Project coverage is 63.73%. Comparing base (84cb9c8) to head (42c23d9).
Report is 1 commits behind head on 2.x.

Files Patch % Lines
...gins/data/public/antlr/dql/.generated/DQLParser.ts 55.76% 174 Missing and 18 partials ⚠️
...c/plugins/data/public/antlr/dql/code_completion.ts 70.12% 9 Missing and 14 partials ⚠️
...ugins/data/public/antlr/dql/.generated/DQLLexer.ts 76.47% 8 Missing ⚠️
...ashboards_react/public/code_editor/code_editor.tsx 36.36% 3 Missing and 4 partials ⚠️
...s/data/public/autocomplete/autocomplete_service.ts 0.00% 2 Missing ⚠️
src/plugins/data/public/plugin.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              2.x    #7590      +/-   ##
==========================================
- Coverage   63.77%   63.73%   -0.04%     
==========================================
  Files        3629     3633       +4     
  Lines       79534    80088     +554     
  Branches    12599    12672      +73     
==========================================
+ Hits        50722    51047     +325     
- Misses      25743    25939     +196     
- Partials     3069     3102      +33     
Flag Coverage Δ
Linux_1 30.57% <11.31%> (-0.19%) ⬇️
Linux_2 55.70% <ø> (ø)
Linux_3 40.61% <59.13%> (+0.19%) ⬆️
Linux_4 31.46% <11.80%> (-0.24%) ⬇️
Windows_1 30.59% <11.31%> (-0.19%) ⬇️
Windows_2 55.65% <ø> (ø)
Windows_3 40.63% <59.13%> (+0.21%) ⬆️
Windows_4 31.46% <11.80%> (-0.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LDrago27 LDrago27 merged commit b423572 into 2.x Jul 30, 2024
67 of 70 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants