From a32fd0c588a6da11fd6d5d2fb0362308da3206f3 Mon Sep 17 00:00:00 2001 From: Andrey Vorobev Date: Fri, 17 May 2024 18:18:31 +0300 Subject: [PATCH] WEB-60601 Support Next.js 13+ App directory for href links WEB-67556 Support for special path resolving for frameworks with file system-based routing GitOrigin-RevId: 91f2839b1a20173eef34c4524b9c41e820782e66 --- .../htmltools/xml/util/HtmlReferenceProvider.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java b/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java index 45d3cd13a7dd..754a0b4213a7 100644 --- a/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java +++ b/plugins/htmltools/src/com/intellij/htmltools/xml/util/HtmlReferenceProvider.java @@ -107,10 +107,12 @@ public final class HtmlReferenceProvider extends PsiReferenceProvider { ) || ( attrName.equalsIgnoreCase(HREF_ATTRIBUTE_NAME) && ( tagName.equalsIgnoreCase("a") || - tagName.equalsIgnoreCase("area") || - tagName.equalsIgnoreCase("link") + tagName.equalsIgnoreCase("area") || + StringUtil.endsWithIgnoreCase(tagName, "link") ) - ) || + ) || + (attrName.equalsIgnoreCase("to") && StringUtil.endsWithIgnoreCase(tagName, "link") + ) || ( attrName.equalsIgnoreCase(USEMAP_ATTR_NAME) && (tagName.equalsIgnoreCase(SizeReference.IMAGE_TAG_NAME) || tagName.equalsIgnoreCase("object")) @@ -248,7 +250,8 @@ public final class HtmlReferenceProvider extends PsiReferenceProvider { ("poster".equals(localName) && "video".equalsIgnoreCase(tag.getName()))) { refs = PathReferenceManager.getInstance().createReferences(element, false, false, true); } - else if (HREF_ATTRIBUTE_NAME.equalsIgnoreCase(localName) && "link".equalsIgnoreCase(tag.getName())) { + else if ((HREF_ATTRIBUTE_NAME.equalsIgnoreCase(localName) || "to".equalsIgnoreCase(localName)) && + (StringUtil.endsWithIgnoreCase(tag.getName(), "link"))) { if (!HtmlUtil.hasHtmlPrefix(text)) { FileType[] fileTypes = findFileTypeByRel(tag.getAttributeValue("rel")); String typeValue = tag.getAttributeValue("type"); @@ -296,7 +299,7 @@ public final class HtmlReferenceProvider extends PsiReferenceProvider { public static String[] getAttributeValues() { return new String[] {SRC_ATTR_NAME, HREF_ATTRIBUTE_NAME, USEMAP_ATTR_NAME, "action", "background", "width", "height", "type", "bgcolor", "color", "vlink", "link", "alink", "text", "name", HtmlUtil.ID_ATTRIBUTE_NAME, HtmlUtil.CLASS_ATTRIBUTE_NAME, FOR_ATTR_NAME, MicrodataUtil.ITEM_REF, "data", "poster", "srcset", - LABELLEDBY + LABELLEDBY, "to" }; }