From bae8195dfd6cd26a7a6d1eb7fcfb48f37769913f Mon Sep 17 00:00:00 2001 From: Giuseppe B <20780192+MrSnix@users.noreply.github.com> Date: Mon, 2 Aug 2021 12:12:58 +0200 Subject: [PATCH] Fix for GraphQL - now autocomplete does not reset anymore (#3468) --- .../app/ui/components/codemirror/code-editor.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx b/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx index b46a35c1b..fbbd67b05 100644 --- a/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx +++ b/packages/insomnia-app/app/ui/components/codemirror/code-editor.tsx @@ -928,7 +928,7 @@ class CodeEditor extends Component { _codemirrorEndCompletion() { if (this._autocompleteDebounce !== null) { - clearInterval(this._autocompleteDebounce); + clearTimeout(this._autocompleteDebounce); } } @@ -944,6 +944,13 @@ class CodeEditor extends Component { if (this._autocompleteDebounce !== null) { clearTimeout(this._autocompleteDebounce); } + + // You don't want to re-trigger the hint dropdown if it's already open + // for other reasons, like forcing its display with Ctrl+Space + if (this.codeMirror?.isHintDropdownActive()) { + return; + } + this._autocompleteDebounce = setTimeout(() => { doc.execCommand('autocomplete'); }, 700);