Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove refreshInlayPresentationDisplay #100

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.zhongan.devpilot.util.ConfigChangeUtils;
import com.zhongan.devpilot.util.ConfigurableUtils;
import com.zhongan.devpilot.util.DevPilotMessageBundle;
import com.zhongan.devpilot.util.EditorUtils;

import javax.swing.JComponent;

Expand Down Expand Up @@ -72,10 +71,6 @@ public void apply() throws ConfigurationException {

var chatShortcutSettings = ChatShortcutSettingState.getInstance();
var methodInlayPresentationDisplayIndex = settingsComponent.getMethodInlayPresentationDisplayIndex();
// if inlay presentation display mode changed, refresh editor
if (!methodInlayPresentationDisplayIndex.equals(chatShortcutSettings.getDisplayIndex())) {
EditorUtils.refreshInlayPresentationDisplay(methodInlayPresentationDisplayIndex);
}
chatShortcutSettings.setDisplayIndex(methodInlayPresentationDisplayIndex);

PopupMenuEditorActionGroupUtil.refreshActions(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.apache.commons.lang3.math.NumberUtils;
import org.jetbrains.annotations.NotNull;

import static com.zhongan.devpilot.util.EditorUtils.refreshInlayPresentationDisplay;

public class StatusBarActions {

public static DefaultActionGroup buildStatusBarActionsGroup() {
Expand Down Expand Up @@ -74,7 +72,6 @@ private static DumbAwareAction createChatShortcutSwitchAction() {
event -> {
ChatShortcutSettingState.getInstance().setEnable(false);
ChatShortcutSettingState.getInstance().setDisplayIndex(NumberUtils.INTEGER_ZERO);

}
);
} else {
Expand All @@ -83,7 +80,6 @@ private static DumbAwareAction createChatShortcutSwitchAction() {
event -> {
ChatShortcutSettingState.getInstance().setEnable(true);
ChatShortcutSettingState.getInstance().setDisplayIndex(NumberUtils.INTEGER_ONE);
refreshInlayPresentationDisplay(NumberUtils.INTEGER_ONE);
}
);
}
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/com/zhongan/devpilot/util/EditorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,15 @@
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.ScrollingModel;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.popup.Balloon;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -86,14 +82,4 @@ public static void openFileByRelativePath(String repo, @NotNull Project project,
FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, file), true);
}

public static void refreshInlayPresentationDisplay(Integer methodInlayPresentationDisplayIndex) {
var projects = ProjectManager.getInstance().getOpenProjects();

Arrays.stream(projects).sequential().forEach(project ->
Optional.ofNullable(FileEditorManager.getInstance(project))
.flatMap(fileEditorManager -> Optional.ofNullable(fileEditorManager.getSelectedTextEditor()))
.flatMap(editor -> Optional.ofNullable(FileDocumentManager.getInstance().getFile(editor.getDocument())))
.ifPresent(virtualFile -> FileEditorManager.getInstance(project).updateFilePresentation(virtualFile))
);
}
}
Loading