Skip to content

[ES|QL] show suggestions on editor refocus#245012

Merged
bartoval merged 6 commits intoelastic:mainfrom
bartoval:show_suggestions_refocus
Dec 5, 2025
Merged

[ES|QL] show suggestions on editor refocus#245012
bartoval merged 6 commits intoelastic:mainfrom
bartoval:show_suggestions_refocus

Conversation

@bartoval
Copy link
Copy Markdown
Contributor

@bartoval bartoval commented Dec 3, 2025

Summary

#180839

focus.mp4

@bartoval bartoval self-assigned this Dec 3, 2025
@bartoval bartoval requested a review from a team as a code owner December 3, 2025 06:41
@bartoval bartoval added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana t// v9.3.0 labels Dec 3, 2025
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@bartoval bartoval force-pushed the show_suggestions_refocus branch from 8cd2ae3 to 6f908e8 Compare December 3, 2025 06:41
const lineContent = model.getLineContent(lineNumber);
const charBeforeCursor = column > 1 ? lineContent[column - 2] : '';

if (charBeforeCursor === ' ') {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there can also be more characters (comma?)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's leave it as it is for now and we can add more later after playing with it (and receive possible feedback)

showSuggestionsIfEmptyQuery();
setLabelInFocus(true);
}, [showSuggestionsIfEmptyQuery]);
const onEditorFocus = useCallback(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm still not clear on why this method is called onKeyDown .
Probably for some race condition to setIsCodeEditorExpandedFocused(true) ;, setLabelInFocus(true); ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont think they are needed anymore, it seems as leftovers (I tested it without them and it works fine). Let's clean it up here!

@bartoval bartoval force-pushed the show_suggestions_refocus branch from 6f908e8 to f39afd3 Compare December 3, 2025 07:07
@elastic elastic deleted a comment from elasticmachine Dec 4, 2025
Copy link
Copy Markdown
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.

I love it!!! Added some comments but I am approving as I dont need to test again

const lineContent = model.getLineContent(lineNumber);
const charBeforeCursor = column > 1 ? lineContent[column - 2] : '';

if (charBeforeCursor === ' ') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's leave it as it is for now and we can add more later after playing with it (and receive possible feedback)


editor.onDidFocusEditorText(() => {
onEditorFocus();
const shouldTriggerSuggestions = !isFirstFocusRef.current;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this? What bug is it solving? Can you add a comment explaining because we will forget it

showSuggestionsIfEmptyQuery();
setLabelInFocus(true);
}, [showSuggestionsIfEmptyQuery]);
const onEditorFocus = useCallback(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont think they are needed anymore, it seems as leftovers (I tested it without them and it works fine). Let's clean it up here!

@bartoval bartoval force-pushed the show_suggestions_refocus branch from 2c871ab to 5351515 Compare December 4, 2025 14:52
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
esql 674.8KB 674.9KB +98.0B

History

cc @bartoval

@bartoval bartoval merged commit 4bccc94 into elastic:main Dec 5, 2025
12 checks passed
wildemat pushed a commit to wildemat/kibana that referenced this pull request Dec 5, 2025
JordanSh pushed a commit to JordanSh/kibana that referenced this pull request Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana release_note:skip Skip the PR/issue when compiling release notes Team:ESQL ES|QL related features in Kibana t// v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants