mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-66333 Quick documentation lookup on mouse hover
Corrected links appliance in case of partial head match
This commit is contained in:
@@ -191,6 +191,10 @@ public class DocPreviewUtil {
|
||||
// We don't want to perform the replacement then.
|
||||
continue;
|
||||
}
|
||||
if (end - i > 1 && i > 0 && !ALLOWED_LINK_SEPARATORS.contains(text.charAt(i - 1))) {
|
||||
// Similar situation but targets head match: from = 'TextRange', text = 'getTextRange()'.
|
||||
continue;
|
||||
}
|
||||
text.replace(i, end, replaceTo);
|
||||
int diff = replaceTo.length() - replaceFrom.length();
|
||||
for (int j = 0; j < readOnlyChanges.size(); j++) {
|
||||
|
||||
+19
-1
@@ -147,7 +147,7 @@ Qname'''
|
||||
}
|
||||
|
||||
@Test
|
||||
void substrings() {
|
||||
void tailSubstrings() {
|
||||
def header = '''\
|
||||
PsiResolveHelperImpl
|
||||
public static com.intellij.openapi.util.Pair<com.intellij.psi.PsiType, com.intellij.psi.ConstraintType> getSubstitutionForTypeParameterConstraint (com.intellij.psi.PsiTypeParameter typeParam, com.intellij.psi.PsiType param, com.intellij.psi.PsiType arg, boolean isContraVariantPosition, com.intellij.pom.java.LanguageLevel languageLevel)'''
|
||||
@@ -164,4 +164,22 @@ public static com.intellij.openapi.util.Pair<com.intellij.psi.PsiType, com.in
|
||||
|
||||
assertEquals(expected, DocPreviewUtil.buildPreview(header, null, fullText))
|
||||
}
|
||||
|
||||
@Test
|
||||
void headSubstrings() {
|
||||
def header = '''\
|
||||
ASTNode
|
||||
com.intellij.openapi.util.TextRange getTextRange ()'''
|
||||
|
||||
def fullText = '''\
|
||||
<html><head> <style type="text/css"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head><body><small><b><a href="psi_element://com.intellij.lang.ASTNode"><code>com.intellij.lang.ASTNode</code></a></b></small><PRE><a href="psi_element://com.intellij.openapi.util.TextRange"><code>TextRange</code></a> <b>getTextRange</b>()</PRE>
|
||||
Returns the text range (a combination of starting offset in the document and length) for this node.
|
||||
|
||||
<DD><DL><DT><b>Returns:</b><DD>the text range.</DD></DL></DD></body></html>'''
|
||||
|
||||
def expected = '''\
|
||||
<a href="psi_element://com.intellij.lang.ASTNode">ASTNode</a><br/><a href="psi_element://com.intellij.openapi.util.TextRange">TextRange</a> getTextRange ()'''
|
||||
|
||||
assertEquals(expected, DocPreviewUtil.buildPreview(header, null, fullText))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user