Skip to content

Commit

Permalink
Fix com.intellij.diagnostic.PluginException by providing label as act…
Browse files Browse the repository at this point in the history
…ion description (fixes #95)
  • Loading branch information
carlrobertoh committed May 17, 2023
1 parent 2e6e0b7 commit 0520d1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/main/java/ee/carlrobert/codegpt/action/ActionsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public static void refreshActions() {

var configuredActions = ConfigurationState.getInstance().tableData;
configuredActions.forEach((label, prompt) -> {
var action = new BaseAction(label) {
// using label as action description to prevent com.intellij.diagnostic.PluginException
// https://github.com/carlrobertoh/CodeGPT/issues/95
var action = new BaseAction(label, label) {
@Override
protected void actionPerformed(Project project, Editor editor, String selectedText) {
var fileExtension = FileUtils.getFileExtension(
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/ee/carlrobert/codegpt/action/BaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public BaseAction(
ActionsUtil.registerOrReplaceAction(this);
}

public BaseAction(@Nullable @NlsActions.ActionText String text) {
this(text, null, null);
public BaseAction(
@Nullable @NlsActions.ActionText String text,
@Nullable @NlsActions.ActionDescription String description) {
this(text, description, null);
}

protected abstract void actionPerformed(Project project, Editor editor, String selectedText);
Expand Down

0 comments on commit 0520d1a

Please sign in to comment.