diff --git a/CHANGELOG.md b/CHANGELOG.md index 284f3fb..c050b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.5.3 230730 + +### Fixes +- updated and tested new version for later IDE + ## 0.5.2 230629 ### Added diff --git a/build.gradle.kts b/build.gradle.kts index 0e235b5..034ba7e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ plugins { id("java") - id("org.jetbrains.intellij") version "1.13.3" + id("org.jetbrains.intellij") version "1.15.0" id("idea") } group = "com.en_circle.slt" -version = "0.5.2" +version = "0.5.3" idea { module { @@ -24,8 +24,8 @@ dependencies { implementation("org.rauschig:jarchivelib:1.2.0") implementation("org.jsoup:jsoup:1.16.1") - testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.3") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.3") + testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.0") + testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.10.0") } sourceSets { @@ -39,7 +39,7 @@ sourceSets { // Configure Gradle IntelliJ Plugin // Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html intellij { - version.set("2022.2") + version.set("2023.2") pluginName.set("slt") var ide = System.getenv("TARGET_IDE") if (ide == null || "" == ide) @@ -89,8 +89,8 @@ tasks { } patchPluginXml { - sinceBuild.set("222") - untilBuild.set("231.*") + sinceBuild.set("232") + untilBuild.set("242.*") } signPlugin { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..070cb70 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/en_circle/slt/plugin/SltProjectActivity.java b/src/main/java/com/en_circle/slt/plugin/SltProjectActivity.java new file mode 100644 index 0000000..3300276 --- /dev/null +++ b/src/main/java/com/en_circle/slt/plugin/SltProjectActivity.java @@ -0,0 +1,19 @@ +package com.en_circle.slt.plugin; + +import com.en_circle.slt.plugin.services.SltProjectService; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.startup.ProjectActivity; +import kotlin.Unit; +import kotlin.coroutines.Continuation; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class SltProjectActivity implements ProjectActivity { + + @Nullable + @Override + public Object execute(@NotNull Project project, @NotNull Continuation continuation) { + SltProjectService.getInstance(project); + return null; + } +} diff --git a/src/main/java/com/en_circle/slt/plugin/SltProjectListener.java b/src/main/java/com/en_circle/slt/plugin/SltProjectListener.java deleted file mode 100644 index b28bf23..0000000 --- a/src/main/java/com/en_circle/slt/plugin/SltProjectListener.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.en_circle.slt.plugin; - -import com.en_circle.slt.plugin.services.SltProjectService; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ProjectManagerListener; -import org.jetbrains.annotations.NotNull; - -public class SltProjectListener implements ProjectManagerListener { - - @Override - public void projectOpened(@NotNull Project project) { - SltProjectService.getInstance(project); - } - -} diff --git a/src/main/java/com/en_circle/slt/plugin/highlights/SltBraceHighlighter.java b/src/main/java/com/en_circle/slt/plugin/highlights/SltBraceHighlighter.java index ea8983f..4f4a2d4 100644 --- a/src/main/java/com/en_circle/slt/plugin/highlights/SltBraceHighlighter.java +++ b/src/main/java/com/en_circle/slt/plugin/highlights/SltBraceHighlighter.java @@ -32,7 +32,7 @@ import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypes; import com.intellij.openapi.project.Project; -import com.intellij.openapi.startup.StartupActivity; +import com.intellij.openapi.startup.ProjectActivity; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.TextRange; import com.intellij.psi.PsiBinaryFile; @@ -44,6 +44,8 @@ import com.intellij.util.Alarm; import com.intellij.util.containers.Stack; import com.intellij.util.text.CharArrayUtil; +import kotlin.Unit; +import kotlin.coroutines.Continuation; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -53,21 +55,23 @@ // Copied from IJ source to implement highlight WITHOUT smart insertion! -public class SltBraceHighlighter implements StartupActivity.DumbAware { +public class SltBraceHighlighter implements ProjectActivity { private static final Key> BRACE_HIGHLIGHTERS_IN_EDITOR_VIEW_KEY = Key.create("BraceHighlighter.BRACE_HIGHLIGHTERS_IN_EDITOR_VIEW_KEY"); private static final Key LINE_MARKER_IN_EDITOR_KEY = Key.create("BraceHighlighter.LINE_MARKER_IN_EDITOR_KEY"); private final Alarm alarm = new Alarm(); + @Nullable @Override - public void runActivity(@NotNull Project project) { + public Object execute(@NotNull Project project, @NotNull Continuation continuation) { if (ApplicationManager.getApplication().isHeadlessEnvironment() && !ApplicationManager.getApplication().isUnitTestMode() || !IdentifierHighlighterPassFactory.isEnabled()) { - return; + return null; } Disposable activityDisposable = SltProjectService.getInstance(project); registerListeners(project, activityDisposable); + return null; } private void registerListeners(@NotNull Project project, @NotNull Disposable parentDisposable) { diff --git a/src/main/java/com/en_circle/slt/plugin/indentation/SltIndentator.java b/src/main/java/com/en_circle/slt/plugin/indentation/SltIndentator.java index 41e2983..e0809f0 100644 --- a/src/main/java/com/en_circle/slt/plugin/indentation/SltIndentator.java +++ b/src/main/java/com/en_circle/slt/plugin/indentation/SltIndentator.java @@ -9,6 +9,7 @@ import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.editor.ex.util.EditorUIUtil; +import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.InvalidStateException; import com.intellij.openapi.editor.textarea.TextComponentEditor; import com.intellij.openapi.util.Ref; import com.intellij.psi.PsiDocumentManager; @@ -99,7 +100,11 @@ public void run() { EditorModificationUtil.deleteSelectedText(editor); int caretOffset = editor.getCaretModel().getOffset(); String s = "\n" + StringUtils.repeat(' ', additionalOffset); - document.insertString(caretOffset, s); + try { + document.insertString(caretOffset, s); + } catch (InvalidStateException ignored) { + // lexer error is ignored + } editor.getCaretModel().moveToOffset(caretOffset + s.length()); EditorModificationUtil.scrollToCaret(editor); editor.getSelectionModel().removeSelection(); diff --git a/src/main/java/com/en_circle/slt/plugin/ui/SltPackageWidget.java b/src/main/java/com/en_circle/slt/plugin/ui/SltPackageWidget.java index 7c7250e..4e42e7e 100644 --- a/src/main/java/com/en_circle/slt/plugin/ui/SltPackageWidget.java +++ b/src/main/java/com/en_circle/slt/plugin/ui/SltPackageWidget.java @@ -10,7 +10,6 @@ import com.intellij.openapi.editor.EditorFactory; import com.intellij.openapi.editor.event.*; import com.intellij.openapi.editor.ex.EditorEx; -import com.intellij.openapi.fileEditor.FileEditorManagerEvent; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.NlsContexts.Label; @@ -127,11 +126,6 @@ public void caretRemoved(@NotNull CaretEvent e) { updatePosition(e.getEditor()); } - @Override - public void selectionChanged(@NotNull FileEditorManagerEvent event) { - updatePosition(getEditor()); - } - @Override public void afterDocumentChange(@NotNull Document document) { EditorFactory.getInstance().editors(document) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e2d5e44..ecd6e69 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -142,6 +142,8 @@ + + @@ -274,8 +276,6 @@ -