some optimizations
This commit is contained in:
@@ -54,10 +54,8 @@ public class LineEnd extends EditorLinePainter {
|
||||
@NotNull SelectionModel select = editor.getSelectionModel();
|
||||
@Nullable VisualPosition start = select.getSelectionStartPosition();
|
||||
int lineNum = lineNumber + 1;
|
||||
if (start != null) {
|
||||
if (lineNum < start.getLine()) {
|
||||
return null;
|
||||
}
|
||||
if (start != null && lineNum < start.getLine()) {
|
||||
return null;
|
||||
}
|
||||
@Nullable VisualPosition end = select.getSelectionEndPosition();
|
||||
if (end != null && lineNum > end.getLine()) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package io.github.linwancen.plugin.show.ext.conf;
|
||||
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import io.github.linwancen.plugin.show.settings.ShowBundle;
|
||||
|
||||
@@ -32,6 +32,8 @@ public class ResetExtDocAction extends AnAction {
|
||||
if (project == null) {
|
||||
return;
|
||||
}
|
||||
ApplicationManager.getApplication().invokeLater(() ->
|
||||
ProjectView.getInstance(project).refresh());
|
||||
} catch (Throwable t) {
|
||||
LOG.info("ConfFileChangeListener catch Throwable but log to record.", t);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package io.github.linwancen.plugin.show.lang.base;
|
||||
|
||||
import io.github.linwancen.plugin.show.bean.SettingsInfo;
|
||||
import io.github.linwancen.plugin.show.settings.AbstractSettingsState;
|
||||
import io.github.linwancen.plugin.show.settings.AppSettingsState;
|
||||
import io.github.linwancen.plugin.show.settings.GlobalSettingsState;
|
||||
import io.github.linwancen.plugin.show.settings.ProjectSettingsState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -27,7 +27,7 @@ public class GlobalSettingsComponent extends AbstractSettingsComponent {
|
||||
|
||||
@NotNull
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return myMainPanel;
|
||||
return lineEndCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package io.github.linwancen.plugin.show.settings;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class PatternMapUtils {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PatternMapUtils.class);
|
||||
private PatternMapUtils() {}
|
||||
|
||||
public static final Pattern LINE_PATTERN = Pattern.compile("[\\r\\n]++");
|
||||
public static final Pattern SPLIT_PATTERN = Pattern.compile("\\|\\|");
|
||||
@@ -29,7 +26,9 @@ public class PatternMapUtils {
|
||||
for (int i = 1; i < split.length; i++) {
|
||||
try {
|
||||
patterns.add(Pattern.compile(split[i]));
|
||||
} catch (Exception ignore) {}
|
||||
} catch (Exception ignore) {
|
||||
// ignroe
|
||||
}
|
||||
}
|
||||
map.put(split[0], patterns.toArray(new Pattern[0]));
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
class DirDoc {
|
||||
private DirDoc() {}
|
||||
|
||||
@Nullable
|
||||
static String dirDoc(@NotNull PsiDirectoryNode node, @NotNull AbstractSettingsState settings) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
class FileDoc {
|
||||
private FileDoc() {}
|
||||
|
||||
@Nullable
|
||||
static String fileDoc(@NotNull PsiFileNode node, @NotNull AbstractSettingsState settings) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
class FilePatternsDoc {
|
||||
private FilePatternsDoc() {}
|
||||
|
||||
@Nullable
|
||||
static String filePatternsDoc(@NotNull PsiFile psiFile, @NotNull Pattern[] patterns) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class RelFileDoc {
|
||||
private RelFileDoc() {}
|
||||
|
||||
@Nullable
|
||||
public static String relFileDoc(ProjectViewNode<?> node, @NotNull SettingsInfo settingsInfo) {
|
||||
|
||||
Reference in New Issue
Block a user