From 0574b8d927f4bd79d17a0640256301e78f6a8c00 Mon Sep 17 00:00:00 2001 From: Zhiming Ma Date: Mon, 11 Nov 2024 19:10:09 +0800 Subject: [PATCH] chore(eclipse): update DebouncedDocumentEventTrigger and use as default. --- clients/eclipse/feature/feature.xml | 4 ++-- clients/eclipse/plugin/META-INF/MANIFEST.MF | 2 +- .../trigger/DebouncedDocumentEventTrigger.java | 7 ++++--- .../inlineCompletion/trigger/InlineCompletionTrigger.java | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/clients/eclipse/feature/feature.xml b/clients/eclipse/feature/feature.xml index 3a3b4dc29ad2..2834f66f1670 100644 --- a/clients/eclipse/feature/feature.xml +++ b/clients/eclipse/feature/feature.xml @@ -2,7 +2,7 @@ @@ -19,6 +19,6 @@ + version="0.0.2.28"/> diff --git a/clients/eclipse/plugin/META-INF/MANIFEST.MF b/clients/eclipse/plugin/META-INF/MANIFEST.MF index 4bd0adabb224..1a77766e4846 100644 --- a/clients/eclipse/plugin/META-INF/MANIFEST.MF +++ b/clients/eclipse/plugin/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Tabby Plugin for Eclipse Bundle-SymbolicName: com.tabbyml.tabby4eclipse;singleton:=true -Bundle-Version: 0.0.2.27 +Bundle-Version: 0.0.2.28 Bundle-Activator: com.tabbyml.tabby4eclipse.Activator Bundle-Vendor: com.tabbyml Require-Bundle: org.eclipse.ui, diff --git a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/DebouncedDocumentEventTrigger.java b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/DebouncedDocumentEventTrigger.java index 4dd9fab0fd8e..a2b4c1c50d19 100644 --- a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/DebouncedDocumentEventTrigger.java +++ b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/DebouncedDocumentEventTrigger.java @@ -26,7 +26,8 @@ * valid. */ public class DebouncedDocumentEventTrigger implements IInlineCompletionTrigger { - private final static int DEBOUNCE_INTERVAL = 20; // ms + private final static int DOCUMENT_CHANGED_DEBOUNCE_INTERVAL = 3; // ms + private final static int CARET_MOVED_DEBOUNCE_INTERVAL = 16; // ms private Logger logger = new Logger("InlineCompletionTrigger.DebouncedDocumentEventTrigger"); @@ -96,7 +97,7 @@ public void unregister(ITextEditor textEditor) { } catch (Exception e) { logger.error("Failed to handle documentChangedRunnable after debouncing.", e); } - }, DEBOUNCE_INTERVAL); + }, DOCUMENT_CHANGED_DEBOUNCE_INTERVAL); private DebouncedRunnable caretMovedRunnable = new DebouncedRunnable(() -> { try { @@ -111,7 +112,7 @@ public void unregister(ITextEditor textEditor) { } catch (Exception e) { logger.error("Failed to handle caretMovedRunnable after debouncing.", e); } - }, DEBOUNCE_INTERVAL); + }, CARET_MOVED_DEBOUNCE_INTERVAL); private void handleCaretMoved(ITextEditor textEditor, CaretEvent event) { if (!EditorUtils.isActiveEditor(textEditor)) { diff --git a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/InlineCompletionTrigger.java b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/InlineCompletionTrigger.java index 0102f8a6b55c..3dbb8299cde8 100644 --- a/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/InlineCompletionTrigger.java +++ b/clients/eclipse/plugin/src/com/tabbyml/tabby4eclipse/inlineCompletion/trigger/InlineCompletionTrigger.java @@ -34,6 +34,6 @@ public static IInlineCompletionTrigger createInstance() { if (EXPERIMENTAL_TRIGGER_PAIREDDOCUMENT) { return new PairedDocumentEventTrigger(); } - return new BasicInputEventTrigger(); + return new DebouncedDocumentEventTrigger(); } }