diff --git a/platform/platform-resources/src/META-INF/XmlPlugin.xml b/platform/platform-resources/src/META-INF/XmlPlugin.xml index 91023ebb5f2a..0a738f983ce1 100644 --- a/platform/platform-resources/src/META-INF/XmlPlugin.xml +++ b/platform/platform-resources/src/META-INF/XmlPlugin.xml @@ -102,6 +102,10 @@ + + diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.java index 14cbfcd117da..404ff0018454 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlAutoPopupHandler.java @@ -28,6 +28,8 @@ import com.intellij.psi.PsiWhiteSpace; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.templateLanguages.TemplateLanguageFileViewProvider; import com.intellij.psi.xml.XmlTag; +import com.intellij.util.containers.ContainerUtil; +import com.intellij.xml.psi.codeInsight.XmlAutoPopupEnabler; import com.intellij.xml.util.HtmlUtil; import com.intellij.xml.util.XmlUtil; import org.jetbrains.annotations.NotNull; @@ -35,7 +37,10 @@ import org.jetbrains.annotations.NotNull; public class XmlAutoPopupHandler extends TypedHandlerDelegate { @NotNull @Override - public Result checkAutoPopup(final char charTyped, @NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { + public Result checkAutoPopup(final char charTyped, + @NotNull final Project project, + @NotNull final Editor editor, + @NotNull final PsiFile file) { final boolean isXmlLikeFile = XmlGtTypedHandler.fileContainsXmlLanguage(file); boolean spaceInTag = isXmlLikeFile && charTyped == ' '; @@ -58,7 +63,7 @@ public class XmlAutoPopupHandler extends TypedHandlerDelegate { return Result.CONTINUE; } - public static void autoPopupXmlLookup(final Project project, final Editor editor){ + public static void autoPopupXmlLookup(final Project project, final Editor editor) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, file -> { int offset = editor.getCaretModel().getOffset(); @@ -98,7 +103,8 @@ public class XmlAutoPopupHandler extends TypedHandlerDelegate { text.equals(" ") && isLanguageRelevant(lastElement, file, isRelevantLanguage, isAnt) || text.endsWith("${") && isLanguageRelevant(lastElement, file, isRelevantLanguage, isAnt) && isAnt.get().booleanValue() || text.endsWith("@{") && isLanguageRelevant(lastElement, file, isRelevantLanguage, isAnt) && isAnt.get().booleanValue() || - text.endsWith(" p.shouldShowPopup(file, offset))) { return true; } @@ -126,6 +132,4 @@ public class XmlAutoPopupHandler extends TypedHandlerDelegate { } return result.booleanValue(); } - - } \ No newline at end of file diff --git a/xml/xml-psi-api/src/com/intellij/xml/psi/codeInsight/XmlAutoPopupEnabler.java b/xml/xml-psi-api/src/com/intellij/xml/psi/codeInsight/XmlAutoPopupEnabler.java new file mode 100644 index 000000000000..77a703753530 --- /dev/null +++ b/xml/xml-psi-api/src/com/intellij/xml/psi/codeInsight/XmlAutoPopupEnabler.java @@ -0,0 +1,14 @@ +// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.xml.psi.codeInsight; + +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.ApiStatus; + +@ApiStatus.Experimental +public interface XmlAutoPopupEnabler { + + ExtensionPointName EP_NAME = new ExtensionPointName<>("com.intellij.xml.autoPopupEnabler"); + + boolean shouldShowPopup(PsiFile file, int offset); +}