Skip to content

[Console] Add ESQL autocomplete support in single quotes#224601

Merged
ElenaStoeva merged 5 commits intoelastic:mainfrom
ElenaStoeva:console/esql-autcomplete-single-quotes
Jun 20, 2025
Merged

[Console] Add ESQL autocomplete support in single quotes#224601
ElenaStoeva merged 5 commits intoelastic:mainfrom
ElenaStoeva:console/esql-autcomplete-single-quotes

Conversation

@ElenaStoeva
Copy link
Contributor

@ElenaStoeva ElenaStoeva commented Jun 19, 2025

Closes #223954
Closes #223921

Summary

This PR adds support for ESQL autocompletion inside single quotes, which allows suggestions that include triple quotes such as KQL(``````).

Screenshot 2025-06-19 at 13 39 51

Changes include:

  • The lexer rules have been updated to recognize single-quote query as ESQL so that the highlighting is correct
  • We escape and unescape characters that are invalid in a Console string when we suggest inside single quotes so that we don't cause errors in Console

How to test:
Make sure that ESQL suggestions are displayed inside both "query": "... and "query": """... and that suggestions that contain quotes are correctly escaped inside single-quote queries.

@ElenaStoeva ElenaStoeva self-assigned this Jun 19, 2025
@ElenaStoeva ElenaStoeva requested a review from a team as a code owner June 19, 2025 15:21
@ElenaStoeva ElenaStoeva added the Feature:Console Dev Tools Console Feature label Jun 19, 2025
@ElenaStoeva ElenaStoeva requested review from a team as code owners June 19, 2025 15:21
@ElenaStoeva ElenaStoeva added Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v9.1.0 v8.19.0 labels Jun 19, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@ElenaStoeva ElenaStoeva requested a review from stratoula June 19, 2025 15:23
/*
* This function returns an array of completion items for the esql suggestions
*/
export const getEsqlCompletionItems = (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was unnecessarily added in #219980 but it's not used anywhere so safe to remove.

Copy link
Contributor

Choose a reason for hiding this comment

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

Something goes wrong with the suggestions when there is in single quotes. It should not re-suggest from

image image

@SoniaSanzV SoniaSanzV requested review from a team and SoniaSanzV June 20, 2025 08:33
@ElenaStoeva
Copy link
Contributor Author

Thanks for reviewing @stratoula! I think one of my last commits caused this this issue - I just fixed it in cea4aac!

Copy link
Contributor

@SoniaSanzV SoniaSanzV left a comment

Choose a reason for hiding this comment

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

tested locally, lgtm :)

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #12 / Entity Analytics - Entity Store @ess Host transform logic Install Entity Store and test Host transform "before each" hook for "Should successfully collect all expected fields"

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
console 247 246 -1

Async chunks

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

id before after diff
console 193.4KB 193.7KB +327.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.7MB 3.7MB +563.0B

History

cc @ElenaStoeva

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.

Seems good now, I did a very brief testing but we can fix bugs as a follow up. Thanx Elena, I love it more than the triple quotes 👼

@ElenaStoeva ElenaStoeva merged commit 88ef1ac into elastic:main Jun 20, 2025
10 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/15781785111

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- [Console] Fix autoselecting last request (#218001)

Manual backport

To create the backport manually run:

node scripts/backport --pr 224601

Questions ?

Please refer to the Backport tool documentation

@ElenaStoeva
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

ElenaStoeva added a commit to ElenaStoeva/kibana that referenced this pull request Jun 20, 2025
)

Closes elastic#223954
Closes elastic#223921

## Summary

This PR adds support for ESQL autocompletion inside single quotes, which
allows suggestions that include triple quotes such as `KQL(``````)`.

<img width="1165" alt="Screenshot 2025-06-19 at 13 39 51"
src="https://github.com/user-attachments/assets/8ff59bf7-534e-4539-8cf8-2a1145dbf842"
/>

**Changes include:**
- The lexer rules have been updated to recognize single-quote query as
ESQL so that the highlighting is correct
- We escape and unescape characters that are invalid in a Console string
when we suggest inside single quotes so that we don't cause errors in
Console

**How to test:**
Make sure that ESQL suggestions are displayed inside both `"query":
"...` and `"query": """...` and that suggestions that contain quotes are
correctly escaped inside single-quote queries.

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
(cherry picked from commit 88ef1ac)

# Conflicts:
#	src/platform/packages/shared/kbn-monaco/src/console/index.ts
#	src/platform/plugins/shared/console/public/application/containers/editor/monaco_editor_actions_provider.ts
ElenaStoeva added a commit that referenced this pull request Jun 23, 2025
) (#224733)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Console] Add ESQL autocomplete support in single quotes
(#224601)](#224601)

<!--- Backport version: 10.0.1 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-20T14:58:54Z","message":"[Console]
Add ESQL autocomplete support in single quotes (#224601)\n\nCloses
https://github.com/elastic/kibana/issues/223954\nCloses
https://github.com/elastic/kibana/issues/223921\n\n## Summary\n\nThis PR
adds support for ESQL autocompletion inside single quotes, which\nallows
suggestions that include triple quotes such as `KQL(``````)`.\n \n<img
width=\"1165\" alt=\"Screenshot 2025-06-19 at 13 39
51\"\nsrc=\"https://github.com/user-attachments/assets/8ff59bf7-534e-4539-8cf8-2a1145dbf842\"\n/>\n\n**Changes
include:**\n- The lexer rules have been updated to recognize
single-quote query as\nESQL so that the highlighting is correct\n- We
escape and unescape characters that are invalid in a Console
string\nwhen we suggest inside single quotes so that we don't cause
errors in\nConsole\n\n**How to test:**\nMake sure that ESQL suggestions
are displayed inside both `\"query\":\n\"...` and `\"query\": \"\"\"...`
and that suggestions that contain quotes are\ncorrectly escaped inside
single-quote queries.\n\n---------\n\nCo-authored-by: Stratoula
Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"88ef1ac8b2a5a77803c3102d3124c23e3d3bc6e9","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana
Management","release_note:skip","backport:version","v9.1.0","v8.19.0"],"title":"[Console]
Add ESQL autocomplete support in single
quotes","number":224601,"url":"https://github.com/elastic/kibana/pull/224601","mergeCommit":{"message":"[Console]
Add ESQL autocomplete support in single quotes (#224601)\n\nCloses
https://github.com/elastic/kibana/issues/223954\nCloses
https://github.com/elastic/kibana/issues/223921\n\n## Summary\n\nThis PR
adds support for ESQL autocompletion inside single quotes, which\nallows
suggestions that include triple quotes such as `KQL(``````)`.\n \n<img
width=\"1165\" alt=\"Screenshot 2025-06-19 at 13 39
51\"\nsrc=\"https://github.com/user-attachments/assets/8ff59bf7-534e-4539-8cf8-2a1145dbf842\"\n/>\n\n**Changes
include:**\n- The lexer rules have been updated to recognize
single-quote query as\nESQL so that the highlighting is correct\n- We
escape and unescape characters that are invalid in a Console
string\nwhen we suggest inside single quotes so that we don't cause
errors in\nConsole\n\n**How to test:**\nMake sure that ESQL suggestions
are displayed inside both `\"query\":\n\"...` and `\"query\": \"\"\"...`
and that suggestions that contain quotes are\ncorrectly escaped inside
single-quote queries.\n\n---------\n\nCo-authored-by: Stratoula
Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"88ef1ac8b2a5a77803c3102d3124c23e3d3bc6e9"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224601","number":224601,"mergeCommit":{"message":"[Console]
Add ESQL autocomplete support in single quotes (#224601)\n\nCloses
https://github.com/elastic/kibana/issues/223954\nCloses
https://github.com/elastic/kibana/issues/223921\n\n## Summary\n\nThis PR
adds support for ESQL autocompletion inside single quotes, which\nallows
suggestions that include triple quotes such as `KQL(``````)`.\n \n<img
width=\"1165\" alt=\"Screenshot 2025-06-19 at 13 39
51\"\nsrc=\"https://github.com/user-attachments/assets/8ff59bf7-534e-4539-8cf8-2a1145dbf842\"\n/>\n\n**Changes
include:**\n- The lexer rules have been updated to recognize
single-quote query as\nESQL so that the highlighting is correct\n- We
escape and unescape characters that are invalid in a Console
string\nwhen we suggest inside single quotes so that we don't cause
errors in\nConsole\n\n**How to test:**\nMake sure that ESQL suggestions
are displayed inside both `\"query\":\n\"...` and `\"query\": \"\"\"...`
and that suggestions that contain quotes are\ncorrectly escaped inside
single-quote queries.\n\n---------\n\nCo-authored-by: Stratoula
Kalafateli
<efstratia.kalafateli@elastic.co>","sha":"88ef1ac8b2a5a77803c3102d3124c23e3d3bc6e9"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sonia Sanz Vivas <sonia.sanzvivas@elastic.co>
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Jun 25, 2025
)

Closes elastic#223954
Closes elastic#223921

## Summary

This PR adds support for ESQL autocompletion inside single quotes, which
allows suggestions that include triple quotes such as `KQL(``````)`.
 
<img width="1165" alt="Screenshot 2025-06-19 at 13 39 51"
src="https://github.com/user-attachments/assets/8ff59bf7-534e-4539-8cf8-2a1145dbf842"
/>

**Changes include:**
- The lexer rules have been updated to recognize single-quote query as
ESQL so that the highlighting is correct
- We escape and unescape characters that are invalid in a Console string
when we suggest inside single quotes so that we don't cause errors in
Console

**How to test:**
Make sure that ESQL suggestions are displayed inside both `"query":
"...` and `"query": """...` and that suggestions that contain quotes are
correctly escaped inside single-quote queries.

---------

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
@ElenaStoeva ElenaStoeva deleted the console/esql-autcomplete-single-quotes branch January 31, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels Feature:Console Dev Tools Console Feature release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Console] Add support for ESQL suggestions that contain triple quotes [Console] Add hint for ESQL autocompletions

6 participants