Skip to content

Commit f004f08

Browse files
authored
[ES|QL] Suppress auto suggestions on tab (#290477)
## Summary Closes #290266 The whole thing is the result of our auto trigger mechanism. I am suppressing it in case of Tab so now the users can use tab for indentation without the suggestions firing all the time.
1 parent 79cf2d8 commit f004f08

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/platform/packages/private/kbn-esql-editor/src/esql_editor.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,16 @@ const ESQLEditorInternal = function ESQLEditor({
904904
onLayoutChangeRef.current(layoutInfoEvent);
905905
});
906906

907+
const tabKeyDisposable = editor.onKeyDown((e) => {
908+
if (
909+
e.keyCode === monaco.KeyCode.Tab &&
910+
!e.shiftKey &&
911+
!isSuggestionPopupOpenRef.current
912+
) {
913+
suppressSuggestionsRef.current = true;
914+
}
915+
});
916+
907917
const modelContentDisposable = editor.onDidChangeModelContent(async () => {
908918
trackInputLatencyOnKeystroke(editor.getValue() ?? '');
909919
await addLookupIndicesDecorator();
@@ -917,6 +927,7 @@ const ESQLEditorInternal = function ESQLEditor({
917927
mouseDownDisposable,
918928
focusDisposable,
919929
layoutChangeDisposable,
930+
tabKeyDisposable,
920931
modelContentDisposable,
921932
suggestionPopupDisposable,
922933
commentLineDisposable,

src/platform/packages/private/kbn-esql-editor/src/hooks/use_editor_config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ export const useEditorConfig = ({
229229
verticalScrollbarSize: 6,
230230
},
231231
scrollBeyondLastLine: false,
232+
acceptSuggestionOnTab: 'off',
232233
tabSize: 2,
233234
theme: ESQL_LANG_ID,
234235
wordWrap: 'on',

0 commit comments

Comments
 (0)