Skip to content
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
15 changes: 15 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: overengineer44
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:

# Run Qodana inspections
- name: Qodana - Code Inspection
uses: JetBrains/qodana-action@v2023.3.1
uses: JetBrains/qodana-action@v2024.2
with:
cache-default-branch-only: true

Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:

# Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
with:
gradle-home-cache-cleanup: true

Expand All @@ -219,7 +219,7 @@ jobs:

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

# Collect Plugin Verifier Result
- name: Collect Plugin Verifier Result
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## [Unreleased]

## [0.5.6]
### Changed
- Added 2 settings options to disable HTML stripping and XML unescaping
### Fixed
- Generics in error messages were stripped because of the HTML stripping

## [0.5.5]
### Changed
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pluginGroup = org.OverEngineer
pluginName = InlineProblems
pluginRepositoryUrl = https://github.com/OverEngineer/InlineProblems
# SemVer format -> https://semver.org
pluginVersion = 0.5.5
pluginVersion = 0.5.6

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 212.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

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

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

Expand All @@ -46,6 +47,8 @@
private DocumentMarkupModelScanner() {
Disposer.register(problemManager, this);

settingsState = SettingsState.getInstance();

mergingUpdateQueue = new MergingUpdateQueue(
"DocumentMarkupModelScannerQueue",
10,
Expand Down Expand Up @@ -166,10 +169,11 @@

InlineProblem newProblem = new InlineProblem(
document.getLineNumber(highlightInfo.getStartOffset()),
textEditor.getFile().getPath(),

Check warning on line 172 in src/main/java/org/overengineer/inlineproblems/DocumentMarkupModelScanner.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Method invocation `getPath` may produce `NullPointerException`

Check warning on line 172 in src/main/java/org/overengineer/inlineproblems/DocumentMarkupModelScanner.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Nullability and data flow problems

Method invocation `getPath` may produce `NullPointerException`
highlightInfo,
textEditor,
h
h,
settingsState
);

problemManager.applyCustomSeverity(newProblem);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.overengineer.inlineproblems.definitions;

import java.util.regex.Pattern;

public class RegexPattern {
public static final Pattern HTML_TAG_PATTERN = Pattern.compile("</?(b|i|u|html|body|div|span|br|p|code|pre|strong|em)(\\s+[^>]*)?>");
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import org.overengineer.inlineproblems.definitions.RegexPattern;
import org.overengineer.inlineproblems.settings.SettingsState;

@Getter
@Setter
Expand All @@ -17,6 +18,7 @@ public class InlineProblem {

// The line the problem first appeared
private final int line;
@Setter
private int severity;

// If two problems with the same text occur in the same line only one will be shown
Expand Down Expand Up @@ -49,13 +51,14 @@ public InlineProblem(
String filePath,
HighlightInfo highlightInfo,
TextEditor textEditor,
RangeHighlighter rangeHighlighter
RangeHighlighter rangeHighlighter,
SettingsState settingsState
) {
String usedText = highlightInfo.getDescription();
if (usedText == null)
usedText = "";
else
usedText = getTextWithoutHtmlOrXml(usedText.stripLeading());
usedText = getTextWithHtmlStrippingAndXmlUnescaping(usedText.stripLeading(), settingsState);

this.line = line;
this.text = usedText;
Expand All @@ -72,16 +75,21 @@ public InlineProblem(
this.actualEndOffset = highlightInfo.getActualEndOffset() -1;
}

public void setSeverity(int severity) {
this.severity = severity;
}

private String getTextWithoutHtmlOrXml(String text) {
if (text.contains("<"))
private String getTextWithHtmlStrippingAndXmlUnescaping(String text, SettingsState settingsState) {
if (
settingsState.isEnableHtmlStripping() &&
text.contains("<") &&
RegexPattern.HTML_TAG_PATTERN.matcher(text).find()
Copy link

@yluom yluom Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see how this fixes #69, but won't you have the same problem if the error contains html AND GenericTypes<LikeThis> ?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are absolutely correct but i hope that HTML and generics in one error message does not happen very often... :D

And the HTML stripping can now be disabled in the settings so i think this is the best we can have without too much work.

) {
text = StringUtil.stripHtml(text, " ");
}

if (text.contains("&"))
if (
settingsState.isEnableHtmlStripping() &&
text.contains("&")
) {
text = StringUtil.unescapeXmlEntities(text);
}

return text;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ private void handleEvent(EventType type, @NotNull RangeHighlighterEx highlighter
textEditor.getFile().getPath(),
highlightInfo,
textEditor,
highlighter
highlighter,
settingsState
);

if (type == EventType.CHANGE || type == EventType.REMOVE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class SettingsComponent {
private final JBCheckBox useEditorFont = new JBCheckBox(SettingsBundle.message("settings.useEditorFont"));

private final JBCheckBox showOnlyHighestSeverityPerLine = new JBCheckBox(SettingsBundle.message("settings.showOnlyHighestPerLine"));
private final JBCheckBox enableHtmlStripping = new JBCheckBox(SettingsBundle.message("settings.enableHtmlStripping"));
private final JBCheckBox enableXmlUnescaping = new JBCheckBox(SettingsBundle.message("settings.enableXmlUnescaping"));
private final JFormattedTextField inlayFontSizeDeltaText;
private final JFormattedTextField manualScannerDelay;
private final JBCheckBox fillProblemLabels = new JBCheckBox(SettingsBundle.message("settings.fillProblemLabels"));
Expand Down Expand Up @@ -164,6 +166,8 @@ public SettingsComponent() {
.addComponent(forceErrorsInSameLine, 0)
.addComponent(useEditorFont, 0)
.addComponent(showOnlyHighestSeverityPerLine, 0)
.addComponent(enableHtmlStripping, 0)
.addComponent(enableXmlUnescaping, 0)
.addLabeledComponent(new JBLabel(SettingsBundle.message("settings.inlaySizeDelta")), inlayFontSizeDeltaText)
.addTooltip(SettingsBundle.message("settings.inlaySizeDeltaTooltip"))
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.problemFilterListLabel")), problemFilterList)
Expand Down Expand Up @@ -247,6 +251,14 @@ public boolean isShowOnlyHighestSeverityPerLine() {
return showOnlyHighestSeverityPerLine.isSelected();
}

public boolean isEnableHtmlStripping() {
return enableHtmlStripping.isSelected();
}

public boolean isEnableXmlUnescaping() {
return enableXmlUnescaping.isSelected();
}

public int getInlayFontSizeDelta() {
int val = 0;
// Convert the String
Expand All @@ -273,6 +285,14 @@ public void setShowOnlyHighestSeverityPerLine(boolean isSelected) {
showOnlyHighestSeverityPerLine.setSelected(isSelected);
}

public void setEnableHtmlStripping(boolean isSelected) {
enableHtmlStripping.setSelected(isSelected);
}

public void setEnableXmlUnescaping(boolean isSelected) {
enableXmlUnescaping.setSelected(isSelected);
}

public boolean isFillProblemLabels() {
return fillProblemLabels.isSelected();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
SettingsConfigurable() {}

@Override
@NlsContexts.ConfigurableName

Check warning on line 23 in src/main/java/org/overengineer/inlineproblems/settings/SettingsConfigurable.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.intellij.openapi.util.NlsContexts.ConfigurableName' is declared in unstable class 'com.intellij.openapi.util.NlsContexts' marked with @ApiStatus.Experimental

Check warning on line 23 in src/main/java/org/overengineer/inlineproblems/settings/SettingsConfigurable.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.intellij.openapi.util.NlsContexts' is marked unstable with @ApiStatus.Experimental

Check warning on line 23 in src/main/java/org/overengineer/inlineproblems/settings/SettingsConfigurable.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.intellij.openapi.util.NlsContexts.ConfigurableName' is declared in unstable class 'com.intellij.openapi.util.NlsContexts' marked with @ApiStatus.Experimental

Check warning on line 23 in src/main/java/org/overengineer/inlineproblems/settings/SettingsConfigurable.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unstable API Usage

'com.intellij.openapi.util.NlsContexts' is marked unstable with @ApiStatus.Experimental
public String getDisplayName() {
return "InlineProblems";
}
Expand All @@ -46,6 +46,8 @@
state.isRoundedCornerBoxes() == settingsComponent.isRoundedCornerBoxes() &&
state.isUseEditorFont() == settingsComponent.isUseEditorFont() &&
state.isShowOnlyHighestSeverityPerLine() == settingsComponent.isShowOnlyHighestSeverityPerLine() &&
state.isEnableHtmlStripping() == settingsComponent.isEnableHtmlStripping() &&
state.isEnableXmlUnescaping() == settingsComponent.isEnableXmlUnescaping() &&
state.getInlayFontSizeDelta() == settingsComponent.getInlayFontSizeDelta() &&
state.isFillProblemLabels() == settingsComponent.isFillProblemLabels() &&
state.isBoldProblemLabels() == settingsComponent.isBoldProblemLabels() &&
Expand Down Expand Up @@ -135,6 +137,8 @@
state.setRoundedCornerBoxes(settingsComponent.isRoundedCornerBoxes());
state.setUseEditorFont(settingsComponent.isUseEditorFont());
state.setShowOnlyHighestSeverityPerLine(settingsComponent.isShowOnlyHighestSeverityPerLine());
state.setEnableHtmlStripping(settingsComponent.isEnableHtmlStripping());
state.setEnableXmlUnescaping(settingsComponent.isEnableXmlUnescaping());
state.setInlayFontSizeDelta(settingsComponent.getInlayFontSizeDelta());
state.setFillProblemLabels(settingsComponent.isFillProblemLabels());
state.setBoldProblemLabels(settingsComponent.isBoldProblemLabels());
Expand Down Expand Up @@ -203,6 +207,8 @@
settingsComponent.setRoundedCornerBoxes(state.isRoundedCornerBoxes());
settingsComponent.setUseEditorFont(state.isUseEditorFont());
settingsComponent.setShowOnlyHighestSeverityPerLine(state.isShowOnlyHighestSeverityPerLine());
settingsComponent.setEnableHtmlStripping(state.isEnableHtmlStripping());
settingsComponent.setEnableXmlUnescaping(state.isEnableXmlUnescaping());
settingsComponent.setInlayFontSizeDelta(state.getInlayFontSizeDelta());
settingsComponent.setFillProblemLabels(state.isFillProblemLabels());
settingsComponent.setBoldProblemLabels(state.isBoldProblemLabels());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
private List<Integer> additionalInfoSeverities = new ArrayList<>();

private boolean showOnlyHighestSeverityPerLine = false;
private boolean enableHtmlStripping = true;
private boolean enableXmlUnescaping = true;

// migration booleans
private boolean highlightProblemListenerDeprecateMigrationDone = false;
Expand Down Expand Up @@ -136,7 +138,7 @@
List<String> newFilterListEntries = List.of("Consider unknown contexts non-blocking");
for (String entry : newFilterListEntries) {
if (!problemFilterList.contains(entry)) {
problemFilterList += ";" + entry;

Check warning on line 141 in src/main/java/org/overengineer/inlineproblems/settings/SettingsState.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

String concatenation in loop

String concatenation `+=` in loop

Check warning on line 141 in src/main/java/org/overengineer/inlineproblems/settings/SettingsState.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

String concatenation in loop

String concatenation `+=` in loop
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/messages/SettingsBundle_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ settings.infoLineHighlightColor=Info line highlight color:
settings.additionalSeveritiesInfoDesc=Semicolon separated list of additional info severities e.g. '10, 100'
settings.forceProblemsInOneLine=Force problems in the same line even if they are too long to fit
settings.useEditorFont=Use editor font instead of tooltip font
settings.showOnlyHighestPerLine=Show only the problem with the highest severity per line
settings.showOnlyHighestPerLine=Show only the problem with the highest severity per line
settings.enableHtmlStripping=Enable stripping of HTML in the messages
settings.enableXmlUnescaping=Enable unescaping of XML in the messages
4 changes: 3 additions & 1 deletion src/main/resources/messages/SettingsBundle_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ settings.infoLineHighlightColor=\u4FE1\u606F\u884C\u7A81\u51FA\u663E\u793A\u989C
settings.additionalSeveritiesInfoDesc=\u9644\u52A0\u4FE1\u606F\u4E25\u91CD\u6027\u7684\u7528\u5206\u53F7\u5206\u9694\u7684\u5217\u8868\uFF0C\u4F8B\u5982 '10, 100'
settings.forceProblemsInOneLine=\u5F3A\u5236\u5728\u540C\u4E00\u884C\u663E\u793A\u95EE\u9898\uFF0C\u5373\u4F7F\u5B83\u4EEC\u592A\u957F\u800C\u65E0\u6CD5\u9002\u5E94
settings.useEditorFont=\u4F7F\u7528\u7F16\u8F91\u5668\u5B57\u4F53\u800C\u4E0D\u662F\u63D0\u793A\u5B57\u4F53
settings.showOnlyHighestPerLine=\u4ec5\u663e\u793a\u6bcf\u884c\u4e2d\u6700\u4e25\u91cd\u7684\u95ee\u9898
settings.showOnlyHighestPerLine=\u4ec5\u663e\u793a\u6bcf\u884c\u4e2d\u6700\u4e25\u91cd\u7684\u95ee\u9898
settings.enableHtmlStripping=Enable stripping of HTML in the messages
settings.enableXmlUnescaping=Enable unescaping of XML in the messages
Loading