Skip to content

Commit

Permalink
Merge pull request #48 from 0verEngineer/dev
Browse files Browse the repository at this point in the history
Dev -> Main for 0.5.1
  • Loading branch information
0verEngineer authored Nov 13, 2023
2 parents b29610c + ae8def4 commit de2b779
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
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.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
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.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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public void drawLineHighlighterAndGutterIcon(List<InlineProblem> problemsInLine)
}

Editor editor = problem.getTextEditor().getEditor();
Document document = editor.getDocument();

if (document.getLineCount() <= problem.getLine()) {
return;
}

TextAttributes textAttributes = new TextAttributes(
editor.getColorsScheme().getDefaultForeground(),
Expand All @@ -112,8 +117,6 @@ public void drawLineHighlighterAndGutterIcon(List<InlineProblem> 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()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;
}
}

0 comments on commit de2b779

Please sign in to comment.