From 9e1aff284e5f9a7987fcfe69c6c1fc7cef2028cb Mon Sep 17 00:00:00 2001 From: Alexandr Evstigneev Date: Fri, 18 Jul 2025 07:20:08 +0400 Subject: [PATCH] IJPL-184662 Moved references-related stuff into backend module GitOrigin-RevId: a6b8c3e7bf8f3cb0e422496cc1c29978b803fbe0 --- plugins/IntelliLang/backend/BUILD.bazel | 53 ++++++++++++++++++- ...ntellij.platform.langInjection.backend.iml | 15 ++++-- ...ntellij.platform.langInjection.backend.xml | 16 ++++++ .../references/FileReferenceInjector.java | 2 +- .../InjectedReferencesContributor.java | 22 ++++---- .../InjectedReferencesInspection.java | 0 .../LanguageReferenceContributor.kt | 2 +- .../intellij.platform.langInjection.xml | 12 ----- 8 files changed, 93 insertions(+), 29 deletions(-) rename plugins/IntelliLang/{ => backend}/src/org/intellij/plugins/intelliLang/references/FileReferenceInjector.java (95%) rename plugins/IntelliLang/{ => backend}/src/org/intellij/plugins/intelliLang/references/InjectedReferencesContributor.java (88%) rename plugins/IntelliLang/{ => backend}/src/org/intellij/plugins/intelliLang/references/InjectedReferencesInspection.java (100%) rename plugins/IntelliLang/{ => backend}/src/org/intellij/plugins/intelliLang/references/LanguageReferenceContributor.kt (98%) diff --git a/plugins/IntelliLang/backend/BUILD.bazel b/plugins/IntelliLang/backend/BUILD.bazel index b9f52e037722..cb94531853b1 100644 --- a/plugins/IntelliLang/backend/BUILD.bazel +++ b/plugins/IntelliLang/backend/BUILD.bazel @@ -1,5 +1,5 @@ ### auto-generated section `build intellij.platform.langInjection.backend` start -load("@rules_jvm//:jvm.bzl", "jvm_library", "jvm_resources") +load("@rules_jvm//:jvm.bzl", "jvm_library", "jvm_provided_library", "jvm_resources") jvm_resources( name = "backend_resources", @@ -7,11 +7,62 @@ jvm_resources( strip_prefix = "resources" ) +jvm_provided_library( + name = "backend_provided", + lib = "//platform/backend" +) + +jvm_provided_library( + name = "core_provided", + lib = "//platform/core-api:core" +) + +jvm_provided_library( + name = "util_provided", + lib = "//platform/util" +) + +jvm_provided_library( + name = "analysis-impl_provided", + lib = "//platform/analysis-impl" +) + +jvm_provided_library( + name = "analysis_provided", + lib = "//platform/analysis-api:analysis" +) + +jvm_provided_library( + name = "langInjection_provided", + lib = "//plugins/IntelliLang:langInjection" +) + +jvm_provided_library( + name = "util-ui_provided", + lib = "//platform/util:util-ui" +) + +jvm_provided_library( + name = "projectModel_provided", + lib = "//platform/projectModel-api:projectModel" +) + jvm_library( name = "backend", module_name = "intellij.platform.langInjection.backend", visibility = ["//visibility:public"], srcs = glob(["src/**/*.kt", "src/**/*.java"], allow_empty = True), + deps = [ + "@lib//:jetbrains-annotations-provided", + ":backend_provided", + ":core_provided", + ":util_provided", + ":analysis-impl_provided", + ":analysis_provided", + ":langInjection_provided", + ":util-ui_provided", + ":projectModel_provided", + ], runtime_deps = [":backend_resources"] ) ### auto-generated section `build intellij.platform.langInjection.backend` end \ No newline at end of file diff --git a/plugins/IntelliLang/backend/intellij.platform.langInjection.backend.iml b/plugins/IntelliLang/backend/intellij.platform.langInjection.backend.iml index 3f89cd859f54..b48aac1e5b1e 100644 --- a/plugins/IntelliLang/backend/intellij.platform.langInjection.backend.iml +++ b/plugins/IntelliLang/backend/intellij.platform.langInjection.backend.iml @@ -2,11 +2,20 @@ - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/IntelliLang/backend/resources/intellij.platform.langInjection.backend.xml b/plugins/IntelliLang/backend/resources/intellij.platform.langInjection.backend.xml index 613fd7e8a6ce..b081c22901de 100644 --- a/plugins/IntelliLang/backend/resources/intellij.platform.langInjection.backend.xml +++ b/plugins/IntelliLang/backend/resources/intellij.platform.langInjection.backend.xml @@ -3,4 +3,20 @@ + + + + + + + + + diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/FileReferenceInjector.java b/plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/FileReferenceInjector.java similarity index 95% rename from plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/FileReferenceInjector.java rename to plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/FileReferenceInjector.java index 926d03f06296..68d27fe0c597 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/FileReferenceInjector.java +++ b/plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/FileReferenceInjector.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.intelliLang.references; import com.intellij.icons.AllIcons; diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/InjectedReferencesContributor.java b/plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/InjectedReferencesContributor.java similarity index 88% rename from plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/InjectedReferencesContributor.java rename to plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/InjectedReferencesContributor.java index 9029e0c2ae5b..542e1cf3bf7b 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/InjectedReferencesContributor.java +++ b/plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/InjectedReferencesContributor.java @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.intelliLang.references; import com.intellij.lang.injection.InjectedLanguageManager; @@ -106,18 +106,18 @@ public final class InjectedReferencesContributor extends PsiReferenceContributor PsiFile containingFile = element.getContainingFile(); InjectedLanguageManager .getInstance(containingFile.getProject()).enumerateEx(element, containingFile, false, new InjectedReferenceVisitor() { - @Override - public void visitInjectedReference(@NotNull ReferenceInjector injector, - @NotNull List places) { - injected.set(Boolean.TRUE); - element.putUserData(LanguageInjectionSupport.INJECTOR_SUPPORT, registry.getLanguageInjectionSupport()); - for (PsiLanguageInjectionHost.Shred place : places) { - if (place.getHost() == element) { - references.addAll(Arrays.asList(injector.getReferences(element, context, place.getRangeInsideHost()))); + @Override + public void visitInjectedReference(@NotNull ReferenceInjector injector, + @NotNull List places) { + injected.set(Boolean.TRUE); + element.putUserData(LanguageInjectionSupport.INJECTOR_SUPPORT, registry.getLanguageInjectionSupport()); + for (PsiLanguageInjectionHost.Shred place : places) { + if (place.getHost() == element) { + references.addAll(Arrays.asList(injector.getReferences(element, context, place.getRangeInsideHost()))); + } } } - } - }); + }); } } return Pair.create(references.toArray(PsiReference.EMPTY_ARRAY), injected.get()); diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/InjectedReferencesInspection.java b/plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/InjectedReferencesInspection.java similarity index 100% rename from plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/InjectedReferencesInspection.java rename to plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/InjectedReferencesInspection.java diff --git a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/LanguageReferenceContributor.kt b/plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/LanguageReferenceContributor.kt similarity index 98% rename from plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/LanguageReferenceContributor.kt rename to plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/LanguageReferenceContributor.kt index 26549ed0d970..f54bc080b7c8 100644 --- a/plugins/IntelliLang/src/org/intellij/plugins/intelliLang/references/LanguageReferenceContributor.kt +++ b/plugins/IntelliLang/backend/src/org/intellij/plugins/intelliLang/references/LanguageReferenceContributor.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.intellij.plugins.intelliLang.references import com.intellij.codeInsight.completion.* diff --git a/plugins/IntelliLang/resources/intellij.platform.langInjection.xml b/plugins/IntelliLang/resources/intellij.platform.langInjection.xml index 48fec0ef8085..a2e5e84c2c90 100644 --- a/plugins/IntelliLang/resources/intellij.platform.langInjection.xml +++ b/plugins/IntelliLang/resources/intellij.platform.langInjection.xml @@ -54,21 +54,9 @@ - - - - -