Skip to content

Commit

Permalink
Completion display fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
maozhen520 committed Oct 11, 2024
1 parent 9df7e77 commit d37661b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 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

0 comments on commit d37661b

Please sign in to comment.