mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-170735 CTRL+MouseOver popup over inner class does not show outer class
This commit is contained in:
@@ -236,7 +236,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
|
||||
private static void writeTypeRefs(PsiClass aClass, StringBuilder buffer, PsiClassType[] refs) {
|
||||
for (int i = 0; i < refs.length; i++) {
|
||||
JavaDocInfoGenerator.generateType(buffer, refs[i], aClass, false);
|
||||
JavaDocInfoGenerator.generateType(buffer, refs[i], aClass, false, true);
|
||||
|
||||
if (i < refs.length - 1) {
|
||||
buffer.append(", ");
|
||||
@@ -260,7 +260,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
buffer.append(" extends ");
|
||||
|
||||
for (int j = 0; j < refs.length; j++) {
|
||||
JavaDocInfoGenerator.generateType(buffer, refs[j], typeParameterOwner, false);
|
||||
JavaDocInfoGenerator.generateType(buffer, refs[j], typeParameterOwner, false, true);
|
||||
|
||||
if (j < refs.length - 1) {
|
||||
buffer.append(" & ");
|
||||
@@ -297,7 +297,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
generateTypeParameters(method, buffer);
|
||||
|
||||
if (method.getReturnType() != null) {
|
||||
JavaDocInfoGenerator.generateType(buffer, substitutor.substitute(method.getReturnType()), method, false);
|
||||
JavaDocInfoGenerator.generateType(buffer, substitutor.substitute(method.getReturnType()), method, false, true);
|
||||
buffer.append(" ");
|
||||
}
|
||||
|
||||
@@ -307,7 +307,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
PsiParameter[] params = method.getParameterList().getParameters();
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
PsiParameter param = params[i];
|
||||
JavaDocInfoGenerator.generateType(buffer, substitutor.substitute(param.getType()), method, false);
|
||||
JavaDocInfoGenerator.generateType(buffer, substitutor.substitute(param.getType()), method, false, true);
|
||||
buffer.append(" ");
|
||||
if (param.getName() != null) {
|
||||
buffer.append(param.getName());
|
||||
@@ -353,7 +353,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
|
||||
generateModifiers(buffer, field);
|
||||
|
||||
JavaDocInfoGenerator.generateType(buffer, substitutor.substitute(field.getType()), field, false);
|
||||
JavaDocInfoGenerator.generateType(buffer, substitutor.substitute(field.getType()), field, false, true);
|
||||
buffer.append(" ");
|
||||
buffer.append(field.getName());
|
||||
|
||||
@@ -368,7 +368,7 @@ public class JavaDocumentationProvider extends DocumentationProviderEx implement
|
||||
|
||||
generateModifiers(buffer, variable);
|
||||
|
||||
JavaDocInfoGenerator.generateType(buffer, variable.getType(), variable, false);
|
||||
JavaDocInfoGenerator.generateType(buffer, variable.getType(), variable, false, true);
|
||||
|
||||
buffer.append(" ");
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase {
|
||||
def ref = myFixture.file.findReferenceAt(myFixture.editor.caretModel.offset)
|
||||
def doc = CtrlMouseHandler.getInfo(ref.resolve(), ref.element)
|
||||
|
||||
assert doc == "Bar\n java.util.List<java.lang.String> foo(java.lang.String param)"
|
||||
assert doc == "Bar\n List<String> foo(String param)"
|
||||
}
|
||||
|
||||
void testGenericField() {
|
||||
@@ -130,7 +130,7 @@ class JavaDocumentationTest extends LightCodeInsightFixtureTestCase {
|
||||
def ref = myFixture.file.findReferenceAt(myFixture.editor.caretModel.offset)
|
||||
def doc = CtrlMouseHandler.getInfo(ref.resolve(), ref.element)
|
||||
|
||||
assert doc == "Bar\n java.lang.Integer field"
|
||||
assert doc == "Bar\n Integer field"
|
||||
}
|
||||
|
||||
void testMethodInAnonymousClass() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -136,12 +136,7 @@ public class DocPreviewUtil {
|
||||
StringBuilder buffer = new StringBuilder(header);
|
||||
replace(buffer, "\n", "<br/>", modifiedRanges);
|
||||
for (String replaceFrom : sortedReplacements) {
|
||||
String visibleName = replaceFrom;
|
||||
int i = visibleName.lastIndexOf('.');
|
||||
if (i > 0 && i < visibleName.length() - 1) {
|
||||
visibleName = visibleName.substring(i + 1);
|
||||
}
|
||||
replace(buffer, replaceFrom, String.format("<a href=\"%s\">%s</a>", links.get(replaceFrom), visibleName), modifiedRanges);
|
||||
replace(buffer, replaceFrom, String.format("<a href=\"%s\">%s</a>", links.get(replaceFrom), replaceFrom), modifiedRanges);
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
+7
-25
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,8 +32,8 @@ class DocPreviewUtilTest {
|
||||
|
||||
def header = '''\
|
||||
[< 1.7 >] java.lang
|
||||
public final class java.lang.String extends Object
|
||||
implements java.io.Serializable, java.lang.Comparable<java.lang.String>, java.lang.CharSequence\
|
||||
public final class String extends Object
|
||||
implements Serializable, Comparable<String>, CharSequence\
|
||||
'''
|
||||
|
||||
def fullText = '''\
|
||||
@@ -111,29 +111,11 @@ java.lang<br/> public final class <a href="psi_element://java.lang.String">Strin
|
||||
assertTrue(actual.endsWith(expected)) // Can't check for equals() because jdk name might differ on different machines.
|
||||
}
|
||||
|
||||
@Test
|
||||
void fieldTypeSubstitution() {
|
||||
def header = '''\
|
||||
Bar
|
||||
java.util.List<java.lang.String> foo (java.lang.String param)\
|
||||
'''
|
||||
|
||||
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://Bar"><code>Bar</code></a></b></small><PRE><a href="psi_element://java.util.List"><code>java.util.List</code></a><T> <b>foo</b>(T param)</PRE></body></html>\
|
||||
'''
|
||||
|
||||
def expected = '''\
|
||||
<a href="psi_element://Bar">Bar</a><br/> <a href="psi_element://java.util.List">List</a><<a href="psi_element://java.lang.String">String</a>> foo (<a href="psi_element://java.lang.String">String</a> param)\
|
||||
'''
|
||||
def actual = DocPreviewUtil.buildPreview(header, "java.lang.String", fullText)
|
||||
assertEquals(expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
void crossingLinks() {
|
||||
def header = '''\
|
||||
OCCompletionPriority
|
||||
com.jetbrains.objc.lang.completion.OCCompletionPriority SMART_COMPLETION_PRIORITY'''
|
||||
OCCompletionPriority SMART_COMPLETION_PRIORITY'''
|
||||
|
||||
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.jetbrains.objc.lang.completion.OCCompletionPriority"><code>com.jetbrains.objc.lang.completion.OCCompletionPriority</code></a></b></small><PRE><a href="psi_element://com.jetbrains.objc.lang.completion.OCCompletionPriority"><code>OCCompletionPriority</code></a> <b>SMART_COMPLETION_PRIORITY</b></PRE></body></html>
|
||||
@@ -150,7 +132,7 @@ Qname'''
|
||||
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)'''
|
||||
public static Pair<PsiType, ConstraintType> getSubstitutionForTypeParameterConstraint (PsiTypeParameter typeParam, PsiType param, PsiType arg, boolean isContraVariantPosition, LanguageLevel languageLevel)'''
|
||||
|
||||
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.psi.impl.source.resolve.PsiResolveHelperImpl"><code>com.intellij.psi.impl.source.resolve.PsiResolveHelperImpl</code></a></b></small><PRE>@<a href="psi_element://org.jetbrains.annotations.Nullable"><code>Nullable</code></a> public static <a href="psi_element://com.intellij.openapi.util.Pair"><code>Pair</code></a><<a href="psi_element://com.intellij.psi.PsiType"><code>PsiType</code></a>, <a href="psi_element://com.intellij.psi.ConstraintType"><code>ConstraintType</code></a>> <b>getSubstitutionForTypeParameterConstraint</b>(<a href="psi_element://com.intellij.psi.PsiTypeParameter"><code>PsiTypeParameter</code></a> typeParam,
|
||||
@@ -169,7 +151,7 @@ public static com.intellij.openapi.util.Pair<com.intellij.psi.PsiType, com.in
|
||||
void headSubstrings() {
|
||||
def header = '''\
|
||||
ASTNode
|
||||
com.intellij.openapi.util.TextRange getTextRange ()'''
|
||||
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>
|
||||
@@ -187,7 +169,7 @@ com.intellij.openapi.util.TextRange getTextRange ()'''
|
||||
void "single letter 'from' substitution"() {
|
||||
def header = '''\
|
||||
E
|
||||
org.denis.E A
|
||||
E A
|
||||
Enum constant ordinal: 0'''
|
||||
|
||||
def fullText = '''\
|
||||
|
||||
Reference in New Issue
Block a user