Skip to content

Commit eeea28e

Browse files
authored
Merge pull request #74 from 0verEngineer/main
0.5.6
2 parents 2efea35 + 2adbca9 commit eeea28e

File tree

13 files changed

+92
-20
lines changed

13 files changed

+92
-20
lines changed

.github/FUNDING.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# These are supported funding model platforms
2+
3+
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: overengineer44
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12+
polar: # Replace with a single Polar username
13+
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14+
thanks_dev: # Replace with a single thanks.dev username
15+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858

5959
# Setup Gradle
6060
- name: Setup Gradle
61-
uses: gradle/actions/setup-gradle@v3
61+
uses: gradle/actions/setup-gradle@v4
6262
with:
6363
gradle-home-cache-cleanup: true
6464

@@ -122,7 +122,7 @@ jobs:
122122

123123
# Setup Gradle
124124
- name: Setup Gradle
125-
uses: gradle/actions/setup-gradle@v3
125+
uses: gradle/actions/setup-gradle@v4
126126
with:
127127
gradle-home-cache-cleanup: true
128128

@@ -175,7 +175,7 @@ jobs:
175175

176176
# Run Qodana inspections
177177
- name: Qodana - Code Inspection
178-
uses: JetBrains/qodana-action@v2023.3.1
178+
uses: JetBrains/qodana-action@v2024.2
179179
with:
180180
cache-default-branch-only: true
181181

@@ -206,7 +206,7 @@ jobs:
206206

207207
# Setup Gradle
208208
- name: Setup Gradle
209-
uses: gradle/actions/setup-gradle@v3
209+
uses: gradle/actions/setup-gradle@v4
210210
with:
211211
gradle-home-cache-cleanup: true
212212

@@ -219,7 +219,7 @@ jobs:
219219

220220
# Run Verify Plugin task and IntelliJ Plugin Verifier tool
221221
- name: Run Plugin Verification tasks
222-
run: ./gradlew runPluginVerifier -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
222+
run: ./gradlew verifyPlugin -Dplugin.verifier.home.dir=${{ needs.build.outputs.pluginVerifierHomeDir }}
223223

224224
# Collect Plugin Verifier Result
225225
- name: Collect Plugin Verifier Result

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
## [Unreleased]
66

7+
## [0.5.6]
8+
### Changed
9+
- Added 2 settings options to disable HTML stripping and XML unescaping
10+
### Fixed
11+
- Generics in error messages were stripped because of the HTML stripping
712

813
## [0.5.5]
914
### Changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pluginGroup = org.OverEngineer
22
pluginName = InlineProblems
33
pluginRepositoryUrl = https://github.com/OverEngineer/InlineProblems
44
# SemVer format -> https://semver.org
5-
pluginVersion = 0.5.5
5+
pluginVersion = 0.5.6
66

77
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
88
pluginSinceBuild = 212.5

src/main/java/org/overengineer/inlineproblems/DocumentMarkupModelScanner.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
public class DocumentMarkupModelScanner implements Disposable {
3232
private final ProblemManager problemManager = ApplicationManager.getApplication().getService(ProblemManager.class);
33+
private final SettingsState settingsState;
3334

3435
private final Logger logger = Logger.getInstance(DocumentMarkupModelScanner.class);
3536

@@ -46,6 +47,8 @@ public class DocumentMarkupModelScanner implements Disposable {
4647
private DocumentMarkupModelScanner() {
4748
Disposer.register(problemManager, this);
4849

50+
settingsState = SettingsState.getInstance();
51+
4952
mergingUpdateQueue = new MergingUpdateQueue(
5053
"DocumentMarkupModelScannerQueue",
5154
10,
@@ -169,7 +172,8 @@ private List<InlineProblem> getProblemsInEditor(TextEditor textEditor) {
169172
textEditor.getFile().getPath(),
170173
highlightInfo,
171174
textEditor,
172-
h
175+
h,
176+
settingsState
173177
);
174178

175179
problemManager.applyCustomSeverity(newProblem);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package org.overengineer.inlineproblems.definitions;
2+
3+
import java.util.regex.Pattern;
4+
5+
public class RegexPattern {
6+
public static final Pattern HTML_TAG_PATTERN = Pattern.compile("</?(b|i|u|html|body|div|span|br|p|code|pre|strong|em)(\\s+[^>]*)?>");
7+
}

src/main/java/org/overengineer/inlineproblems/entities/InlineProblem.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import lombok.EqualsAndHashCode;
99
import lombok.Getter;
1010
import lombok.Setter;
11-
11+
import org.overengineer.inlineproblems.definitions.RegexPattern;
12+
import org.overengineer.inlineproblems.settings.SettingsState;
1213

1314
@Getter
1415
@Setter
@@ -17,6 +18,7 @@ public class InlineProblem {
1718

1819
// The line the problem first appeared
1920
private final int line;
21+
@Setter
2022
private int severity;
2123

2224
// If two problems with the same text occur in the same line only one will be shown
@@ -49,13 +51,14 @@ public InlineProblem(
4951
String filePath,
5052
HighlightInfo highlightInfo,
5153
TextEditor textEditor,
52-
RangeHighlighter rangeHighlighter
54+
RangeHighlighter rangeHighlighter,
55+
SettingsState settingsState
5356
) {
5457
String usedText = highlightInfo.getDescription();
5558
if (usedText == null)
5659
usedText = "";
5760
else
58-
usedText = getTextWithoutHtmlOrXml(usedText.stripLeading());
61+
usedText = getTextWithHtmlStrippingAndXmlUnescaping(usedText.stripLeading(), settingsState);
5962

6063
this.line = line;
6164
this.text = usedText;
@@ -72,16 +75,21 @@ public InlineProblem(
7275
this.actualEndOffset = highlightInfo.getActualEndOffset() -1;
7376
}
7477

75-
public void setSeverity(int severity) {
76-
this.severity = severity;
77-
}
78-
79-
private String getTextWithoutHtmlOrXml(String text) {
80-
if (text.contains("<"))
78+
private String getTextWithHtmlStrippingAndXmlUnescaping(String text, SettingsState settingsState) {
79+
if (
80+
settingsState.isEnableHtmlStripping() &&
81+
text.contains("<") &&
82+
RegexPattern.HTML_TAG_PATTERN.matcher(text).find()
83+
) {
8184
text = StringUtil.stripHtml(text, " ");
85+
}
8286

83-
if (text.contains("&"))
87+
if (
88+
settingsState.isEnableHtmlStripping() &&
89+
text.contains("&")
90+
) {
8491
text = StringUtil.unescapeXmlEntities(text);
92+
}
8593

8694
return text;
8795
}

src/main/java/org/overengineer/inlineproblems/listeners/MarkupModelProblemListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ private void handleEvent(EventType type, @NotNull RangeHighlighterEx highlighter
144144
textEditor.getFile().getPath(),
145145
highlightInfo,
146146
textEditor,
147-
highlighter
147+
highlighter,
148+
settingsState
148149
);
149150

150151
if (type == EventType.CHANGE || type == EventType.REMOVE) {

src/main/java/org/overengineer/inlineproblems/settings/SettingsComponent.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public class SettingsComponent {
6161
private final JBCheckBox useEditorFont = new JBCheckBox(SettingsBundle.message("settings.useEditorFont"));
6262

6363
private final JBCheckBox showOnlyHighestSeverityPerLine = new JBCheckBox(SettingsBundle.message("settings.showOnlyHighestPerLine"));
64+
private final JBCheckBox enableHtmlStripping = new JBCheckBox(SettingsBundle.message("settings.enableHtmlStripping"));
65+
private final JBCheckBox enableXmlUnescaping = new JBCheckBox(SettingsBundle.message("settings.enableXmlUnescaping"));
6466
private final JFormattedTextField inlayFontSizeDeltaText;
6567
private final JFormattedTextField manualScannerDelay;
6668
private final JBCheckBox fillProblemLabels = new JBCheckBox(SettingsBundle.message("settings.fillProblemLabels"));
@@ -164,6 +166,8 @@ public SettingsComponent() {
164166
.addComponent(forceErrorsInSameLine, 0)
165167
.addComponent(useEditorFont, 0)
166168
.addComponent(showOnlyHighestSeverityPerLine, 0)
169+
.addComponent(enableHtmlStripping, 0)
170+
.addComponent(enableXmlUnescaping, 0)
167171
.addLabeledComponent(new JBLabel(SettingsBundle.message("settings.inlaySizeDelta")), inlayFontSizeDeltaText)
168172
.addTooltip(SettingsBundle.message("settings.inlaySizeDeltaTooltip"))
169173
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.problemFilterListLabel")), problemFilterList)
@@ -247,6 +251,14 @@ public boolean isShowOnlyHighestSeverityPerLine() {
247251
return showOnlyHighestSeverityPerLine.isSelected();
248252
}
249253

254+
public boolean isEnableHtmlStripping() {
255+
return enableHtmlStripping.isSelected();
256+
}
257+
258+
public boolean isEnableXmlUnescaping() {
259+
return enableXmlUnescaping.isSelected();
260+
}
261+
250262
public int getInlayFontSizeDelta() {
251263
int val = 0;
252264
// Convert the String
@@ -273,6 +285,14 @@ public void setShowOnlyHighestSeverityPerLine(boolean isSelected) {
273285
showOnlyHighestSeverityPerLine.setSelected(isSelected);
274286
}
275287

288+
public void setEnableHtmlStripping(boolean isSelected) {
289+
enableHtmlStripping.setSelected(isSelected);
290+
}
291+
292+
public void setEnableXmlUnescaping(boolean isSelected) {
293+
enableXmlUnescaping.setSelected(isSelected);
294+
}
295+
276296
public boolean isFillProblemLabels() {
277297
return fillProblemLabels.isSelected();
278298
}

src/main/java/org/overengineer/inlineproblems/settings/SettingsConfigurable.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public boolean isModified() {
4646
state.isRoundedCornerBoxes() == settingsComponent.isRoundedCornerBoxes() &&
4747
state.isUseEditorFont() == settingsComponent.isUseEditorFont() &&
4848
state.isShowOnlyHighestSeverityPerLine() == settingsComponent.isShowOnlyHighestSeverityPerLine() &&
49+
state.isEnableHtmlStripping() == settingsComponent.isEnableHtmlStripping() &&
50+
state.isEnableXmlUnescaping() == settingsComponent.isEnableXmlUnescaping() &&
4951
state.getInlayFontSizeDelta() == settingsComponent.getInlayFontSizeDelta() &&
5052
state.isFillProblemLabels() == settingsComponent.isFillProblemLabels() &&
5153
state.isBoldProblemLabels() == settingsComponent.isBoldProblemLabels() &&
@@ -135,6 +137,8 @@ public void apply() {
135137
state.setRoundedCornerBoxes(settingsComponent.isRoundedCornerBoxes());
136138
state.setUseEditorFont(settingsComponent.isUseEditorFont());
137139
state.setShowOnlyHighestSeverityPerLine(settingsComponent.isShowOnlyHighestSeverityPerLine());
140+
state.setEnableHtmlStripping(settingsComponent.isEnableHtmlStripping());
141+
state.setEnableXmlUnescaping(settingsComponent.isEnableXmlUnescaping());
138142
state.setInlayFontSizeDelta(settingsComponent.getInlayFontSizeDelta());
139143
state.setFillProblemLabels(settingsComponent.isFillProblemLabels());
140144
state.setBoldProblemLabels(settingsComponent.isBoldProblemLabels());
@@ -203,6 +207,8 @@ public void reset() {
203207
settingsComponent.setRoundedCornerBoxes(state.isRoundedCornerBoxes());
204208
settingsComponent.setUseEditorFont(state.isUseEditorFont());
205209
settingsComponent.setShowOnlyHighestSeverityPerLine(state.isShowOnlyHighestSeverityPerLine());
210+
settingsComponent.setEnableHtmlStripping(state.isEnableHtmlStripping());
211+
settingsComponent.setEnableXmlUnescaping(state.isEnableXmlUnescaping());
206212
settingsComponent.setInlayFontSizeDelta(state.getInlayFontSizeDelta());
207213
settingsComponent.setFillProblemLabels(state.isFillProblemLabels());
208214
settingsComponent.setBoldProblemLabels(state.isBoldProblemLabels());

0 commit comments

Comments
 (0)