[devkit] support 'loading' attribute for 'module' tag in plugin.xml (IJPL-161359)

GitOrigin-RevId: 0ac07cca0eea815508edcc1363ac88fdd5b49032
This commit is contained in:
Nikolay Chashnikov
2024-08-30 15:46:42 +02:00
committed by intellij-monorepo-bot
parent 860837cd20
commit e0f8efbb23
6 changed files with 43 additions and 1 deletions

View File

@@ -3,7 +3,6 @@ package org.jetbrains.idea.devkit.dom;
import com.intellij.ide.presentation.Presentation;
import com.intellij.util.xml.*;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.dom.impl.ModuleDescriptorNameConverter;
@@ -26,5 +25,24 @@ public interface ContentDescriptor extends DomElement {
@NameValue(referencable = false)
@Convert(ModuleDescriptorNameConverter.class)
GenericAttributeValue<IdeaPlugin> getName();
@NotNull
@Stubbed
GenericAttributeValue<ModuleLoadingRule> getLoading();
enum ModuleLoadingRule implements NamedEnum {
REQUIRED("required"), OPTIONAL("optional"), ON_DEMAND("on-demand");
private final String myValue;
ModuleLoadingRule(@NotNull String value) {
myValue = value;
}
@Override
public String getValue() {
return myValue;
}
}
}
}

View File

@@ -0,0 +1,11 @@
<idea-plugin>
<id>com.intellij.myPlugin</id>
<vendor>JetBrains</vendor>
<version>1.0</version>
<content>
<module name="requiredModule" loading="required"/>
<module name="onDemandModule" loading="on-demand"/>
<module name="mainModule" loading="<error descr="Unknown enum value 'unknown'">unknown</error>"/>
</content>
</idea-plugin>

View File

@@ -72,6 +72,10 @@ public class PluginXmlContentDependencyDescriptorTest extends JavaCodeInsightFix
public void testContentDescriptorDuplicatedHighlighting() {
doHighlightingTest();
}
public void testContentDescriptorLoadingAttribute() {
doHighlightingTest("requiredModule", "onDemandModule");
}
public void testContentDescriptorNoModuleDescriptorFileHighlighting() {
doHighlightingTest();