Skip to content

Commit

Permalink
Consume javadoc pushdown from jdt.ui to jdt.core.manipulation
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Stryker <[email protected]>

Adjust two tests to newest behavior

Signed-off-by: Rob Stryker <[email protected]>

Override code tag on link

Signed-off-by: Rob Stryker <[email protected]>

WIP - more test cases

Signed-off-by: Rob Stryker <[email protected]>

WIP - more test cases

Signed-off-by: Rob Stryker <[email protected]>

Another test green

Signed-off-by: Rob Stryker <[email protected]>

Fix failing test

Signed-off-by: Rob Stryker <[email protected]>

Delete more files

Signed-off-by: Rob Stryker <[email protected]>

Delete more files

Signed-off-by: Rob Stryker <[email protected]>

Update to platform and jdt ibuilds

Signed-off-by: Rob Stryker <[email protected]>

Update TP

Signed-off-by: Rob Stryker <[email protected]>

Get tests to pass

Signed-off-by: Rob Stryker <[email protected]>

Delete unused file

Signed-off-by: Rob Stryker <[email protected]>

Update to latest ibuild

Signed-off-by: Rob Stryker <[email protected]>

Fix failing test

Signed-off-by: Rob Stryker <[email protected]>

Fix final test

Signed-off-by: Rob Stryker <[email protected]>

Update TP

Signed-off-by: Rob Stryker <[email protected]>
  • Loading branch information
robstryker committed Dec 13, 2023
1 parent 2b5e99a commit 0e1dab3
Show file tree
Hide file tree
Showing 19 changed files with 292 additions and 5,633 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.core.search.SearchRequestor;
import org.eclipse.jdt.internal.core.BinaryMember;
import org.eclipse.jdt.ls.core.internal.handlers.CompletionResolveHandler;
import org.eclipse.jdt.internal.core.manipulation.JavaElementLabelsCore;
import org.eclipse.jdt.ls.core.internal.javadoc.JavaDocSnippetStringEvaluator;
import org.eclipse.jdt.ls.core.internal.handlers.CompletionResolveHandler;
import org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2;
import org.eclipse.jdt.ls.core.internal.managers.IBuildSupport;
import org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager;
Expand Down Expand Up @@ -164,13 +163,13 @@ public List<Either<String, MarkedString>> computeHover(int line, int column, IPr
}

private String fixSnippet(String value) {
if (value.contains(JavaDocSnippetStringEvaluator.SNIPPET)) {
if (value.contains(JavadocContentAccess2.SNIPPET)) {
StringBuilder builder = new StringBuilder();
value.lines().forEach((line) -> {
if (line.contains(JavaDocSnippetStringEvaluator.SNIPPET)) {
if (line.contains(JavadocContentAccess2.SNIPPET)) {
line = line.stripLeading();
if (line.startsWith(JavaDocSnippetStringEvaluator.SNIPPET)) {
line = line.replaceFirst(JavaDocSnippetStringEvaluator.SNIPPET, "");
if (line.startsWith(JavadocContentAccess2.SNIPPET)) {
line = line.replaceFirst(JavadocContentAccess2.SNIPPET, "");
line = replaceLeadingSpaces(line);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@
import org.eclipse.jdt.internal.corext.template.java.SignatureUtil;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
import org.eclipse.jdt.internal.ui.viewsupport.CoreJavaElementLinks;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jdt.launching.environments.IExecutionEnvironment;
import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager;
import org.eclipse.jdt.ls.core.internal.handlers.JsonRpcHelpers;
import org.eclipse.jdt.ls.core.internal.javadoc.JavaElementLinks;
import org.eclipse.jdt.ls.core.internal.managers.ContentProviderManager;
import org.eclipse.jdt.ls.core.internal.managers.ProjectsManager;
import org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager;
Expand Down Expand Up @@ -999,7 +999,7 @@ public static String toURI(ICompilationUnit cu) {
}
} catch (JavaModelException ex) {
JavaLanguageServerPlugin.logException(ex);
}
}
return null;
}

Expand Down Expand Up @@ -1460,7 +1460,7 @@ private static void addValue(StringBuilder buf, Object value, boolean addLinks)
if (type == null || !addLinks) {
buf.append(typeBinding.getName());
} else {
String uri = JavaElementLinks.createURI(JavaElementLinks.JAVADOC_SCHEME, type);
String uri = CoreJavaElementLinks.createURI(CoreJavaElementLinks.JAVADOC_SCHEME, type);
String name = type.getElementName();
addLink(buf, uri, name);
}
Expand All @@ -1471,7 +1471,7 @@ private static void addValue(StringBuilder buf, Object value, boolean addLinks)
if (variable == null || !addLinks) {
buf.append(variableBinding.getName());
} else {
String uri = JavaElementLinks.createURI(JavaElementLinks.JAVADOC_SCHEME, variable);
String uri = CoreJavaElementLinks.createURI(CoreJavaElementLinks.JAVADOC_SCHEME, variable);
String name = variable.getElementName();
addLink(buf, uri, name);
}
Expand Down Expand Up @@ -1501,7 +1501,7 @@ private static void addValue(StringBuilder buf, Object value, boolean addLinks)
}

private static StringBuilder addLink(StringBuilder buf, String uri, String label) {
return buf.append(JavaElementLinks.createLink(uri, label));
return buf.append(CoreJavaElementLinks.createLink(uri, label));
}

private static void addAnnotation(StringBuilder buf, IAnnotationBinding annotation, boolean addLinks) throws URISyntaxException {
Expand All @@ -1510,7 +1510,7 @@ private static void addAnnotation(StringBuilder buf, IAnnotationBinding annotati
if (javaElement == null || !addLinks) {
buf.append(annotation.getName());
} else {
String uri = JavaElementLinks.createURI(JavaElementLinks.JAVADOC_SCHEME, javaElement);
String uri = CoreJavaElementLinks.createURI(CoreJavaElementLinks.JAVADOC_SCHEME, javaElement);
addLink(buf, uri, annotation.getName());
}

Expand All @@ -1523,7 +1523,7 @@ private static void addAnnotation(StringBuilder buf, IAnnotationBinding annotati
}
IMemberValuePairBinding mvPair = mvPairs[j];
if (addLinks) {
String memberURI = JavaElementLinks.createURI(JavaElementLinks.JAVADOC_SCHEME, mvPair.getMethodBinding().getJavaElement());
String memberURI = CoreJavaElementLinks.createURI(CoreJavaElementLinks.JAVADOC_SCHEME, mvPair.getMethodBinding().getJavaElement());
addLink(buf, memberURI, mvPair.getName());
} else {
buf.append(mvPair.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.jdt.ls.core.internal.handlers.SignatureHelpUtils;
import org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess;
import org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2;
import org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager;
import org.eclipse.jdt.ls.core.internal.preferences.Preferences;
import org.eclipse.lsp4j.ParameterInformation;
Expand Down Expand Up @@ -231,7 +231,7 @@ public String computeJavaDoc(CompletionProposal proposal) {
String javadoc = null;
try {
javadoc = SimpleTimeLimiter.create(JavaLanguageServerPlugin.getExecutorService()).callWithTimeout(() -> {
Reader reader = JavadocContentAccess.getPlainTextContentReader(method);
Reader reader = JavadocContentAccess2.getPlainTextContentReader(method);
return reader == null ? null : CharStreams.toString(reader);
}, 500, TimeUnit.MILLISECONDS);
} catch (UncheckedTimeoutException tooSlow) {
Expand Down
Loading

0 comments on commit 0e1dab3

Please sign in to comment.