diff --git a/build.gradle b/build.gradle index d9f5063..b142bb1 100644 --- a/build.gradle +++ b/build.gradle @@ -21,13 +21,13 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent import java.util.concurrent.TimeUnit plugins { - id 'org.jetbrains.intellij' version '1.5.2' + id 'org.jetbrains.intellij' version '1.10.0-SNAPSHOT' } description = 'Manifold :: IJ' -sourceCompatibility = JavaVersion.VERSION_11 -targetCompatibility = JavaVersion.VERSION_11 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 tasks.withType(JavaCompile) { options.encoding = 'UTF-8' @@ -43,9 +43,11 @@ allprojects { if(!System.getenv('CI')) { mavenLocal() } - mavenLocal() mavenCentral() - maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } + maven { + url 'https://oss.sonatype.org/content/repositories/snapshots/' + } + gradlePluginPortal() } // this test block fixes an IJ 2021.3 issue where it won't run tests @@ -123,8 +125,8 @@ runIde { } patchPluginXml { - sinceBuild = '213.0' - untilBuild = '222.*' + sinceBuild = '223.0' + untilBuild = '223.*' } buildSearchableOptions { diff --git a/gradle.properties b/gradle.properties index 128fb31..1b87675 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,7 +17,7 @@ # # -version=2022.1.21 -manifoldVersion=2022.1.19-SNAPSHOT +version=2022.3.22 +manifoldVersion=2022.1.22-SNAPSHOT org.gradle.jvmargs=-Dfile.encoding=UTF-8 defaultIjVersion=LATEST-EAP-SNAPSHOT diff --git a/settings.gradle b/settings.gradle index 71b6522..13d7feb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -17,5 +17,14 @@ * */ +pluginManagement { + repositories { + maven { + url 'https://oss.sonatype.org/content/repositories/snapshots/' + } + gradlePluginPortal() + } +} + rootProject.name = 'manifold-ij' include 'jps-plugin' diff --git a/src/main/java/manifold/ij/core/ManApplicationLoadListener.java b/src/main/java/manifold/ij/core/ManApplicationLoadListener.java index 9326041..315a79e 100644 --- a/src/main/java/manifold/ij/core/ManApplicationLoadListener.java +++ b/src/main/java/manifold/ij/core/ManApplicationLoadListener.java @@ -59,8 +59,6 @@ */ public class ManApplicationLoadListener implements ApplicationLoadListener { - private static volatile boolean Initialized = false; - // @Override in version 2022.x public void beforeApplicationLoaded( @NotNull Application application, @NotNull Path configPath ) { @@ -100,14 +98,15 @@ public void listenToProjectOpenClose() connection.subscribe( ProjectManager.TOPIC, new ProjectManagerListener() { - @Override - public void projectOpened( @NotNull Project project ) - { - initForAllProjects(); - - StartupManagerEx.getInstance( project ).registerStartupActivity( () -> - ApplicationManager.getApplication().runReadAction( () -> ManProject.manProjectFrom( project ).projectOpened() ) ); - } +//jetbrains deprecated, see ManStartupActivity +// @Override +// public void projectOpened( @NotNull Project project ) +// { +// initForAllProjects(); +// +// StartupManagerEx.getInstance( project ).registerStartupActivity( () -> +// ApplicationManager.getApplication().runReadAction( () -> ManProject.manProjectFrom( project ).projectOpened() ) ); +// } @Override public void projectClosed( @NotNull Project project ) @@ -121,37 +120,6 @@ public void projectClosed( @NotNull Project project ) } ); } - /** - * Note the timing of calling this method is critical. It must happen *after* the application has loaded, but before - * the first project loads. This used to happen during {@link com.intellij.openapi.components.ProjectComponent#initComponent}, - * however JetBrains has deprecated components and there is no equivalent listener event (as far as I know). - */ - public void initForAllProjects() - { - if( !Initialized ) - { - synchronized( this ) - { - if( !Initialized ) - { - Initialized = true; - registerAnnotatorWithAllLanguages(); - } - } - } - } - - private void registerAnnotatorWithAllLanguages() - { - // effectively adds annotator to ALL languages - LanguageAnnotators.INSTANCE.addExplicitExtension( Language.ANY, new ManifoldPsiClassAnnotator() ); - - // add brace matcher to templates - LanguageBraceMatching.INSTANCE.addExplicitExtension( ManTemplateLanguage.INSTANCE, - new PairedBraceMatcherAdapter( new ManTemplateBraceMatcher(), ManTemplateLanguage.INSTANCE ) ); - } - - /** * Override Java String literals to handle fragments *
diff --git a/src/main/java/manifold/ij/core/ManStartupActivity.java b/src/main/java/manifold/ij/core/ManStartupActivity.java new file mode 100644 index 0000000..8687b50 --- /dev/null +++ b/src/main/java/manifold/ij/core/ManStartupActivity.java @@ -0,0 +1,75 @@ +/* + * + * * Copyright (c) 2022 - Manifold Systems LLC + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * http://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + * + */ + +package manifold.ij.core; + +import com.intellij.codeInsight.highlighting.PairedBraceMatcherAdapter; +import com.intellij.lang.Language; +import com.intellij.lang.LanguageAnnotators; +import com.intellij.lang.LanguageBraceMatching; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.project.Project; +import manifold.ij.extensions.ManifoldPsiClassAnnotator; +import manifold.ij.template.ManTemplateBraceMatcher; +import manifold.ij.template.ManTemplateLanguage; +import org.jetbrains.annotations.NotNull; + +public class ManStartupActivity implements com.intellij.openapi.startup.StartupActivity +{ + private static volatile boolean Initialized = false; + + @Override + public void runActivity( @NotNull Project project ) + { + initForAllProjects(); + + ApplicationManager.getApplication().runReadAction( () -> ManProject.manProjectFrom( project ).projectOpened() ); + } + + /** + * Note the timing of calling this method is critical. It must happen *after* the application has loaded, but before + * the first project loads. This used to happen during {@link com.intellij.openapi.components.ProjectComponent#initComponent}, + * however JetBrains has deprecated components and there is no equivalent listener event (as far as I know). + */ + public void initForAllProjects() + { + if( !Initialized ) + { + synchronized( this ) + { + if( !Initialized ) + { + Initialized = true; + registerAnnotatorWithAllLanguages(); + } + } + } + } + + private void registerAnnotatorWithAllLanguages() + { + // effectively adds annotator to ALL languages + LanguageAnnotators.INSTANCE.addExplicitExtension( Language.ANY, new ManifoldPsiClassAnnotator() ); + + // add brace matcher to templates + LanguageBraceMatching.INSTANCE.addExplicitExtension( ManTemplateLanguage.INSTANCE, + new PairedBraceMatcherAdapter( new ManTemplateBraceMatcher(), ManTemplateLanguage.INSTANCE ) ); + } + +} diff --git a/src/main/java/manifold/ij/extensions/ManResolveCache.java b/src/main/java/manifold/ij/extensions/ManResolveCache.java index cca7491..c0156ab 100644 --- a/src/main/java/manifold/ij/extensions/ManResolveCache.java +++ b/src/main/java/manifold/ij/extensions/ManResolveCache.java @@ -31,6 +31,7 @@ import com.intellij.psi.infos.CandidateInfo; import com.intellij.psi.infos.MethodCandidateInfo; import com.intellij.psi.search.GlobalSearchScope; +import com.intellij.psi.stubs.StubTextInconsistencyException; import com.intellij.psi.util.*; import java.util.*; @@ -103,7 +104,18 @@ public