Skip to content

Commit fe3bc9f

Browse files
authored
Merge pull request #979 from SeeSharpSoft/v421
Bugfixes for v421
2 parents 13c3345 + 1538d72 commit fe3bc9f

8 files changed

Lines changed: 168 additions & 142 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010

1111
### Fixed
1212

13-
## 4.2.1 - Mar 29, 2026
13+
## 4.2.1 - May 24, 2026
1414

1515
### Fixed
1616

17-
- PluginException: Invalid PSI Element CsvFile when file is invalidated during annotation, intention actions, or inspection fixes
18-
- IncorrectOperationException: parent CsvTableEditorSwing already disposed when async PsiTreeChangeListener registration completes
17+
- PluginException: Invalid PSI Element CsvFile when file is invalidated during annotation, intention actions, or inspection fixes #964
18+
- IncorrectOperationException: parent CsvTableEditorSwing already disposed when async PsiTreeChangeListener registration completes #962
19+
- Modified `CsvPlugin.openLink` to use `executeOnPooledThread` for setting dialogs #953
20+
- Modified `CsvEditorSettings.java` to ensure all getter methods access the internal `OptionSet` directly instead of calling `getState()` #954
21+
- GithubStatusCodeException: 422 Unprocessable Entity - Validation Failed during issue submission #920
1922

2023
## 4.2.0 - Jan 26, 2026
2124

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
pluginName=CSV Editor
66
pluginId=net.seesharpsoft.intellij.plugins.csv
7-
pluginVersion=4.2.0
7+
pluginVersion=4.2.1
88

99
pluginSinceBuild=242
1010

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvGithubIssueSubmitter.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ protected GithubApiRequest<?> createNewIssue(String title, String content) throw
160160
Collections.emptyList());
161161
}
162162

163-
protected String searchExistingIssues(GithubApiRequestExecutor githubExecutor, String title, ProgressIndicator progressIndicator) throws IOException {
163+
protected String searchExistingIssuesNeedle(String title) {
164164
// Create a search needle from the title but ensure it is never null/empty to avoid GitHub 422 (Validation Failed)
165-
String needle = title.replaceAll("\\s*(\\[.*?]|\\(.*?\\)|\\{.*?})\\s*", "");
165+
String needle = title == null ? "" : title.replaceAll("\\s*(\\[.*?]|\\(.*?\\)|\\{.*?})\\s*", "");
166166

167167
// If the sanitized title becomes empty (e.g., only brackets present), fall back to the raw title
168168
if (Strings.isEmptyOrSpaces(needle)) {
@@ -182,6 +182,12 @@ protected String searchExistingIssues(GithubApiRequestExecutor githubExecutor, S
182182
if (Strings.isEmptyOrSpaces(needle)) {
183183
needle = "crash";
184184
}
185+
return needle;
186+
}
187+
188+
protected String searchExistingIssues(GithubApiRequestExecutor githubExecutor, String title, ProgressIndicator progressIndicator) throws IOException {
189+
String needle = searchExistingIssuesNeedle(title);
190+
185191
GithubApiRequest<GithubResponsePage<GithubSearchedIssue>> existingIssueRequest =
186192
GithubApiRequests.Search.Issues.get(
187193
GithubServerPath.DEFAULT_SERVER,

src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvPlugin.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ public class CsvPlugin implements ProjectActivity, DumbAware {
2323
private static void openLink(Project project, String link) {
2424
if (project.isDisposed()) return;
2525

26-
ApplicationManager.getApplication().invokeLater(() ->
27-
{
28-
if (link.startsWith("#")) {
29-
ShowSettingsUtil.getInstance().showSettingsDialog(project, link.substring(1));
30-
} else {
31-
BrowserUtil.browse(link, project);
32-
}
33-
});
26+
if (link.startsWith("#")) {
27+
ApplicationManager.getApplication().executeOnPooledThread(() ->
28+
ShowSettingsUtil.getInstance().showSettingsDialog(project, link.substring(1))
29+
);
30+
} else {
31+
ApplicationManager.getApplication().invokeLater(() ->
32+
BrowserUtil.browse(link, project)
33+
);
34+
}
3435
}
3536

3637
public static void doAsyncProjectMaintenance(@NotNull Project project) {

src/main/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvEditorSettings.java

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ public String getDisplay() {
7575
public static final class OptionSet {
7676
public String CURRENT_PLUGIN_VERSION;
7777

78-
public boolean CARET_ROW_SHOWN;
79-
public boolean USE_SOFT_WRAP;
78+
public boolean CARET_ROW_SHOWN = true;
79+
public boolean USE_SOFT_WRAP = false;
8080
public boolean HIGHTLIGHT_TAB_SEPARATOR = true;
8181
public boolean SHOW_INFO_BALLOON = true;
8282
public String TAB_HIGHLIGHT_COLOR = "-7984";
@@ -100,18 +100,6 @@ public static final class OptionSet {
100100
private boolean isInitialized = false;
101101

102102
public OptionSet() {}
103-
104-
public void init() {
105-
if (this.isInitialized) {
106-
return;
107-
}
108-
109-
EditorSettingsExternalizable editorSettingsExternalizable = EditorSettingsExternalizable.getInstance();
110-
CARET_ROW_SHOWN = editorSettingsExternalizable == null ? true : editorSettingsExternalizable.isCaretRowShown();
111-
USE_SOFT_WRAP = editorSettingsExternalizable == null ? false : editorSettingsExternalizable.isUseSoftWraps();
112-
113-
this.isInitialized = true;
114-
}
115103
}
116104

117105
private OptionSet myOptions = new OptionSet();
@@ -138,7 +126,6 @@ public void removePropertyChangeListener(PropertyChangeListener listener) {
138126

139127
@Override
140128
public OptionSet getState() {
141-
this.myOptions.init();
142129
return this.myOptions;
143130
}
144131

@@ -184,7 +171,7 @@ public void setShowInfoBalloon(boolean showInfoBalloon) {
184171
public Color getTabHighlightColor() {
185172
String color = getState().TAB_HIGHLIGHT_COLOR;
186173
try {
187-
return color == null || color.isEmpty() ? null : Color.decode(getState().TAB_HIGHLIGHT_COLOR);
174+
return color == null || color.isEmpty() ? null : Color.decode(color);
188175
} catch (NumberFormatException exc) {
189176
return null;
190177
}
@@ -195,13 +182,7 @@ public void setTabHighlightColor(Color color) {
195182
}
196183

197184
public EditorPrio getEditorPrio() {
198-
// Important: avoid triggering OptionSet.init() here because it consults
199-
// EditorSettingsExternalizable on first access which may require UI/EDT
200-
// initialization. The file editor providers call this method from background
201-
// threads during provider discovery, and any slow or blocking initialization
202-
// can lead to timeouts when the IDE checks providers.
203-
// Access the current option directly to keep provider checks fast and non-blocking.
204-
return this.myOptions.EDITOR_PRIO;
185+
return getState().EDITOR_PRIO;
205186
}
206187

207188
public void setEditorPrio(EditorPrio editorPrio) {
@@ -217,9 +198,8 @@ public void showTableEditorInfoPanel(boolean showInfoPanel) {
217198
}
218199

219200
public int getTableEditorRowHeight() {
220-
// ensure the current state of row height fits the boundaries (which is checked in the setTableEditorRowHeight method
221-
setTableEditorRowHeight(getState().TABLE_EDITOR_ROW_HEIGHT);
222-
return getState().TABLE_EDITOR_ROW_HEIGHT;
201+
int rowHeight = getState().TABLE_EDITOR_ROW_HEIGHT;
202+
return rowHeight > TABLE_EDITOR_ROW_HEIGHT_MAX || rowHeight < TABLE_EDITOR_ROW_HEIGHT_MIN ? TABLE_EDITOR_ROW_HEIGHT_DEFAULT : rowHeight;
223203
}
224204

225205
public void setTableEditorRowHeight(int rowHeight) {
@@ -268,7 +248,7 @@ public void setDefaultEscapeCharacter(CsvEscapeCharacter defaultEscapeCharacter)
268248

269249
public CsvEscapeCharacter getDefaultEscapeCharacter() {
270250
CsvEscapeCharacter csvValueSeparator = getState().DEFAULT_ESCAPE_CHARACTER;
271-
return csvValueSeparator == null ? ESCAPE_CHARACTER_DEFAULT : getState().DEFAULT_ESCAPE_CHARACTER;
251+
return csvValueSeparator == null ? ESCAPE_CHARACTER_DEFAULT : csvValueSeparator;
272252
}
273253

274254
public void setDefaultValueSeparator(CsvValueSeparator defaultValueSeparator) {

src/test/java/net/seesharpsoft/intellij/plugins/csv/CsvGithubIssueSubmitterTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ public void printStackTrace(PrintWriter writer) {
2828

2929
private CsvGithubIssueSubmitterSubClass classUnderTest = new CsvGithubIssueSubmitterSubClass();
3030

31+
public void testSearchExistingIssuesNeedle() throws Exception {
32+
assertEquals("crash", classUnderTest.searchExistingIssuesNeedle(null));
33+
assertEquals("crash", classUnderTest.searchExistingIssuesNeedle(""));
34+
assertEquals("crash", classUnderTest.searchExistingIssuesNeedle(" "));
35+
assertEquals("test", classUnderTest.searchExistingIssuesNeedle("test"));
36+
assertEquals("test", classUnderTest.searchExistingIssuesNeedle("[Automated Report] test"));
37+
assertEquals("[Automated Report]", classUnderTest.searchExistingIssuesNeedle("[Automated Report]"));
38+
}
39+
3140
public void testGetIssueTitle() {
3241
assertEquals("[Automated Report] Test", classUnderTest.getIssueTitle(new IdeaLoggingEvent("Test", new DummyException("Test"))));
3342
assertEquals("[Automated Report] Unhandled exception in [CoroutineName(com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl), StandaloneCoroutine{Cancelling}, Dispatchers.Default]", classUnderTest.getIssueTitle(new IdeaLoggingEvent("Test", new DummyException("Unhandled exception in [CoroutineName(com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl), StandaloneCoroutine{Cancelling}@5cfe3e69, Dispatchers.Default]"))));

0 commit comments

Comments
 (0)