210 - Add diff function (#213)

* Add diff function

* modify writeSpace

* Remove unnecessary code

* Add telemetry for toolwindow editor actions

---------

Co-authored-by: wang <1625116638@qq.com>
Co-authored-by: Carl-Robert Linnupuu <carlrobertoh@gmail.com>
This commit is contained in:
wangwangxf 2023-10-02 16:24:09 +08:00 committed by GitHub
parent a2738dac0f
commit 8269ba371c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 488 additions and 274 deletions

View file

@ -3,11 +3,13 @@ package ee.carlrobert.codegpt.util;
import static com.intellij.openapi.ui.Messages.CANCEL;
import static com.intellij.openapi.ui.Messages.OK;
import static ee.carlrobert.codegpt.Icons.DefaultIcon;
import static java.util.Objects.requireNonNull;
import com.intellij.execution.ExecutionBundle;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogBuilder;
import com.intellij.openapi.ui.DoNotAskOption;
@ -24,6 +26,7 @@ import ee.carlrobert.codegpt.CodeGPTBundle;
import ee.carlrobert.codegpt.conversations.ConversationsState;
import ee.carlrobert.codegpt.indexes.FolderStructureTreePanel;
import java.awt.Point;
import java.awt.event.MouseEvent;
import org.jetbrains.annotations.NotNull;
public class OverlayUtils {
@ -88,6 +91,17 @@ public class OverlayUtils {
.guessWindowAndAsk() ? OK : CANCEL;
}
public static void showSelectedEditorSelectionWarning(AnActionEvent event) {
var locationOnScreen = ((MouseEvent) event.getInputEvent()).getLocationOnScreen();
locationOnScreen.y = locationOnScreen.y - 16;
showWarningBalloon(
EditorUtils.getSelectedEditor(requireNonNull(event.getProject())) == null
? "Unable to locate a selected editor"
: "Please select a target code before proceeding",
locationOnScreen);
}
public static void showWarningBalloon(String content, Point locationOnScreen) {
showBalloon(content, MessageType.WARNING, locationOnScreen);
}