From c9cc381fb9114a071b509f004c7bcbb3505c22cf Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Mon, 13 Nov 2023 21:26:46 +0100 Subject: [PATCH 1/3] Fixes SettingsBundle missing default --- .../inlineproblems/bundles/SettingsBundle.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/overengineer/inlineproblems/bundles/SettingsBundle.java b/src/main/java/org/overengineer/inlineproblems/bundles/SettingsBundle.java index 155120d..639731e 100644 --- a/src/main/java/org/overengineer/inlineproblems/bundles/SettingsBundle.java +++ b/src/main/java/org/overengineer/inlineproblems/bundles/SettingsBundle.java @@ -6,6 +6,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.PropertyKey; +import java.util.Locale; +import java.util.ResourceBundle; import java.util.function.Supplier; /** @@ -17,19 +19,31 @@ public final class SettingsBundle extends DynamicBundle { @NonNls public static final String BUNDLE = "messages.SettingsBundle"; + + private static final ResourceBundle DEFAULT_BUNDLE = ResourceBundle.getBundle(BUNDLE, Locale.ENGLISH); + private static final SettingsBundle INSTANCE = new SettingsBundle(); private SettingsBundle() { super(BUNDLE); + try { + ResourceBundle.getBundle(BUNDLE, Locale.getDefault()); + } catch (Exception e) { + Locale.setDefault(Locale.ENGLISH); + } } @NotNull public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { - return INSTANCE.getMessage(key, params); + return INSTANCE.messageOrDefault(key, DEFAULT_BUNDLE.getString(key), params); } @NotNull public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { - return INSTANCE.getLazyMessage(key, params); + var result = INSTANCE.messageOrNull(key, params); + if (result == null) { + return () -> DEFAULT_BUNDLE.getString(key); + } + return () -> result; } } \ No newline at end of file From 17546bc73f93310368c675d1e564b18abcecdb00 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Mon, 13 Nov 2023 21:34:24 +0100 Subject: [PATCH 2/3] Prevents gutter icon readding when the line of the problem does not exist anymore --- .../java/org/overengineer/inlineproblems/InlineDrawer.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/overengineer/inlineproblems/InlineDrawer.java b/src/main/java/org/overengineer/inlineproblems/InlineDrawer.java index 4e734e6..5d9f920 100644 --- a/src/main/java/org/overengineer/inlineproblems/InlineDrawer.java +++ b/src/main/java/org/overengineer/inlineproblems/InlineDrawer.java @@ -100,6 +100,11 @@ public void drawLineHighlighterAndGutterIcon(List problemsInLine) } Editor editor = problem.getTextEditor().getEditor(); + Document document = editor.getDocument(); + + if (document.getLineCount() <= problem.getLine()) { + return; + } TextAttributes textAttributes = new TextAttributes( editor.getColorsScheme().getDefaultForeground(), @@ -112,8 +117,6 @@ public void drawLineHighlighterAndGutterIcon(List problemsInLine) if (!drawDetails.isDrawHighlighter()) textAttributes.setBackgroundColor(editor.getColorsScheme().getDefaultBackground()); - Document document = editor.getDocument(); - var highlighter = editor.getMarkupModel().addRangeHighlighter( document.getLineStartOffset(problem.getLine()), document.getLineEndOffset(problem.getLine()), From ae8def422cce4b86f334d0196235fddc6d225860 Mon Sep 17 00:00:00 2001 From: 0verEngineer Date: Mon, 13 Nov 2023 21:36:54 +0100 Subject: [PATCH 3/3] - Bump version to 0.5.1 --- CHANGELOG.md | 5 +++++ gradle.properties | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0f4640..6f0e28e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ## [Unreleased] +## [0.5.1] +### Fixed +- SettingsBundle missing default (Settings not working with non english os language) +- Prevents gutter icon readding when the line of the problem does not exist anymore + ## [0.5.0] ### Added diff --git a/gradle.properties b/gradle.properties index 8a73259..f940f93 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ pluginGroup = org.OverEngineer pluginName = InlineProblems pluginRepositoryUrl = https://github.com/OverEngineer/InlineProblems # SemVer format -> https://semver.org -pluginVersion = 0.5.0 +pluginVersion = 0.5.1 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html pluginSinceBuild = 212.5