IJPL-184662 Moved references-related stuff into backend module

GitOrigin-RevId: a6b8c3e7bf8f3cb0e422496cc1c29978b803fbe0
This commit is contained in:
Alexandr Evstigneev
2025-07-19 07:28:23 +00:00
committed by intellij-monorepo-bot
parent c84e51e4c2
commit 9e1aff284e
8 changed files with 93 additions and 29 deletions
+52 -1
View File
@@ -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
@@ -2,11 +2,20 @@
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false"/>
<content url="file://$MODULE_DIR$/../backend">
<sourceFolder url="file://$MODULE_DIR$/../backend/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/../backend/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="jetbrains-annotations" level="project" />
<orderEntry type="module" module-name="intellij.platform.backend" scope="PROVIDED" />
<orderEntry type="module" module-name="intellij.platform.core" scope="PROVIDED" />
<orderEntry type="module" module-name="intellij.platform.util" scope="PROVIDED" />
<orderEntry type="module" module-name="intellij.platform.analysis.impl" scope="PROVIDED" />
<orderEntry type="module" module-name="intellij.platform.analysis" scope="PROVIDED" />
<orderEntry type="module" module-name="intellij.platform.langInjection" scope="PROVIDED" />
<orderEntry type="module" module-name="intellij.platform.util.ui" scope="PROVIDED" />
<orderEntry type="module" module-name="intellij.platform.projectModel" scope="PROVIDED" />
</component>
</module>
@@ -3,4 +3,20 @@
<module name="intellij.platform.backend"/>
<module name="intellij.platform.langInjection"/>
</dependencies>
<extensions defaultExtensionNs="com.intellij">
<psi.referenceContributor language="" implementation="org.intellij.plugins.intelliLang.references.InjectedReferencesContributor"/>
<psi.symbolReferenceProvider implementationClass="org.intellij.plugins.intelliLang.references.LanguageReferenceContributor"
hostLanguage=""
hostElementClass="com.intellij.psi.PsiComment"
targetClass="org.intellij.plugins.intelliLang.references.LanguageSymbol"/>
<lang.foldingBuilder language="UAST" implementationClass="org.intellij.plugins.intelliLang.references.LanguageCommentFolding"/>
<referenceInjector implementation="org.intellij.plugins.intelliLang.references.FileReferenceInjector"/>
<localInspection implementationClass="org.intellij.plugins.intelliLang.references.InjectedReferencesInspection"
enabledByDefault="true" level="ERROR"
language=""
groupBundle="messages.InspectionsBundle" groupKey="inspection.general.tools.group.name"
key="inspection.injected.references.display.name" bundle="messages.IntelliLangBundle"/>
</extensions>
</idea-plugin>
@@ -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;
@@ -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<? extends PsiLanguageInjectionHost.Shred> 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<? extends PsiLanguageInjectionHost.Shred> 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());
@@ -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.*
@@ -54,21 +54,9 @@
<projectService serviceInterface="org.intellij.plugins.intelliLang.Configuration"
serviceImplementation="org.intellij.plugins.intelliLang.Configuration$Prj"/>
<psi.referenceContributor language="" implementation="org.intellij.plugins.intelliLang.references.InjectedReferencesContributor"/>
<psi.symbolReferenceProvider implementationClass="org.intellij.plugins.intelliLang.references.LanguageReferenceContributor"
hostLanguage=""
hostElementClass="com.intellij.psi.PsiComment"
targetClass="org.intellij.plugins.intelliLang.references.LanguageSymbol"/>
<completion.contributor language="any" implementationClass="org.intellij.plugins.intelliLang.references.LanguageWordInCommentCompletionContributor" />
<registryKey key="org.intellij.intelliLang.comment.completion" defaultValue="true"
description="Enables completion of 'language=' in comments"/>
<lang.foldingBuilder language="UAST" implementationClass="org.intellij.plugins.intelliLang.references.LanguageCommentFolding"/>
<referenceInjector implementation="org.intellij.plugins.intelliLang.references.FileReferenceInjector"/>
<localInspection implementationClass="org.intellij.plugins.intelliLang.references.InjectedReferencesInspection"
enabledByDefault="true" level="ERROR"
language=""
groupBundle="messages.InspectionsBundle" groupKey="inspection.general.tools.group.name"
key="inspection.injected.references.display.name" bundle="messages.IntelliLangBundle"/>
</extensions>
</idea-plugin>