Skip to content

Commit

Permalink
Completion display fix. (#93)
Browse files Browse the repository at this point in the history
* Completion display fix.

* Method shortcut display.
  • Loading branch information
maozhen520 authored Oct 11, 2024
1 parent 5796f29 commit f1ef9f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private CompletionPreview(
devPilotInlay = DevPilotInlay.create(this);
}

public static DevPilotCompletion createInstance(
public static synchronized DevPilotCompletion createInstance(
Editor editor, List<DevPilotCompletion> completions, int offset) {
CompletionPreview preview = getInstance(editor);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.util.TextRange;
import com.intellij.util.ui.EdtInvocationManager;
import com.zhongan.devpilot.completions.prediction.DevPilotCompletion;
import com.zhongan.devpilot.util.CommentUtil;

Expand Down Expand Up @@ -174,13 +175,15 @@ private static void buildDelayTrigger(@NotNull Editor editor,
new TimerTask() {
@Override
public void run() {
singletonOfInlineCompletionHandler().retrieveAndShowCompletion(
editor,
offset,
lastShownSuggestion,
userInput,
completionAdjustment,
completionType);
EdtInvocationManager.invokeAndWaitIfNeeded(
() ->
singletonOfInlineCompletionHandler().retrieveAndShowCompletion(
editor,
offset,
lastShownSuggestion,
userInput,
completionAdjustment,
completionType));
}
}, getTriggerInterval());
lastTriggerInfo.setTimer(timer);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/messages/devpilot_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ devpilot.notification.upgrade.message=Go to upgrade devpilot

devpilot.settings.methodShortcutDisplayModeLabel=Method Shortcut Display Mode
devpilot.settings.methodShortcutHidden=Hidden
devpilot.settings.methodShortcutInlineDisplay=Inline Display
devpilot.settings.methodShortcutGroupDisplay=Group Display
devpilot.settings.methodShortcutInlineDisplay=Inline
devpilot.settings.methodShortcutGroupDisplay=Group

0 comments on commit f1ef9f0

Please sign in to comment.