[ES|QL] show suggestions on editor refocus#245012
Conversation
|
Pinging @elastic/kibana-esql (Team:ESQL) |
8cd2ae3 to
6f908e8
Compare
| const lineContent = model.getLineContent(lineNumber); | ||
| const charBeforeCursor = column > 1 ? lineContent[column - 2] : ''; | ||
|
|
||
| if (charBeforeCursor === ' ') { |
There was a problem hiding this comment.
there can also be more characters (comma?)
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
I'm still not clear on why this method is called onKeyDown .
Probably for some race condition to setIsCodeEditorExpandedFocused(true) ;, setLabelInFocus(true); ?
There was a problem hiding this comment.
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!
6f908e8 to
f39afd3
Compare
stratoula
left a comment
There was a problem hiding this comment.
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 === ' ') { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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!
2c871ab to
5351515
Compare
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @bartoval |
## Summary elastic#180839 https://github.com/user-attachments/assets/fda074a7-4d98-4c0c-b47a-cddbe36e2ea0 --------- Co-authored-by: Stratou <efstratia.kalafateli@elastic.co>
## Summary elastic#180839 https://github.com/user-attachments/assets/fda074a7-4d98-4c0c-b47a-cddbe36e2ea0 --------- Co-authored-by: Stratou <efstratia.kalafateli@elastic.co>
Summary
#180839
focus.mp4