feat: add include file in context to editor context menu (#475)

* feat: add include file in context to editor context menu

* fix: custom title for IncludeFilesInContextAction in editor context menu
This commit is contained in:
Phil 2024-04-18 17:49:04 +02:00 committed by GitHub
parent 29b36c52f8
commit 9666590cb1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 5 deletions

View file

@ -52,6 +52,10 @@ public class IncludeFilesInContextAction extends AnAction {
super(CodeGPTBundle.get("action.includeFilesInContext.title"));
}
public IncludeFilesInContextAction(String customTitleKey) {
super(CodeGPTBundle.get(customTitleKey));
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
var project = e.getProject();
@ -93,11 +97,6 @@ public class IncludeFilesInContextAction extends AnAction {
}
private @Nullable FileCheckboxTree getCheckboxTree(DataContext dataContext) {
var psiElement = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
if (psiElement != null) {
return new PsiElementCheckboxTree(psiElement);
}
var selectedVirtualFiles = VIRTUAL_FILE_ARRAY.getData(dataContext);
if (selectedVirtualFiles != null) {
return new VirtualFileCheckboxTree(selectedVirtualFiles);

View file

@ -11,6 +11,7 @@ import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.project.Project;
import ee.carlrobert.codegpt.CodeGPTKeys;
import ee.carlrobert.codegpt.ReferencedFile;
import ee.carlrobert.codegpt.actions.IncludeFilesInContextAction;
import ee.carlrobert.codegpt.conversations.message.Message;
import ee.carlrobert.codegpt.settings.configuration.ConfigurationSettings;
import ee.carlrobert.codegpt.toolwindow.chat.ChatToolWindowContentManager;
@ -75,6 +76,8 @@ public class EditorActionsUtil {
};
group.add(action);
});
group.addSeparator();
group.add(new IncludeFilesInContextAction("action.includeFileInContext.title"));
}
}