Skip to content

Commit 107af38

Browse files
committed
Supply proper information display string for completion proposal
Signed-off-by: BoykoAlex <alex.boyko@broadcom.com>
1 parent 680b71f commit 107af38

2 files changed

Lines changed: 10 additions & 21 deletions

File tree

org.eclipse.lsp4e.jdt/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: JDT Integration for LSP4E
44
Bundle-SymbolicName: org.eclipse.lsp4e.jdt;singleton:=true
5-
Bundle-Version: 0.14.0.qualifier
5+
Bundle-Version: 0.14.1.qualifier
66
Export-Package: org.eclipse.lsp4e.jdt
77
Automatic-Module-Name: org.eclipse.lsp4e.jdt
88
Bundle-Activator: org.eclipse.lsp4e.jdt.LanguageServerJdtPlugin

org.eclipse.lsp4e.jdt/src/org/eclipse/lsp4e/jdt/LSJavaProposal.java

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2022, 2024 VMware Inc. and others.
2+
* Copyright (c) 2022, 2025 VMware Inc. and others.
33
* This program and the accompanying materials are made
44
* available under the terms of the Eclipse Public License 2.0
55
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -18,25 +18,21 @@
1818

1919
import org.eclipse.core.runtime.FileLocator;
2020
import org.eclipse.core.runtime.IProgressMonitor;
21+
import org.eclipse.jdt.annotation.NonNull;
2122
import org.eclipse.jdt.annotation.Nullable;
2223
import org.eclipse.jdt.internal.codeassist.RelevanceConstants;
2324
import org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal;
24-
import org.eclipse.jdt.internal.ui.text.java.hover.JavadocBrowserInformationControlInput;
2525
import org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover;
2626
import org.eclipse.jdt.ui.PreferenceConstants;
2727
import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal;
28-
import org.eclipse.jface.internal.text.html.BrowserInformationControl;
2928
import org.eclipse.jface.internal.text.html.HTMLPrinter;
3029
import org.eclipse.jface.resource.ColorRegistry;
3130
import org.eclipse.jface.resource.JFaceResources;
3231
import org.eclipse.jface.text.IInformationControlCreator;
3332
import org.eclipse.lsp4e.LanguageServerPlugin;
3433
import org.eclipse.lsp4e.operations.completion.LSCompletionProposal;
35-
import org.eclipse.lsp4e.ui.UI;
3634
import org.eclipse.swt.graphics.FontData;
3735
import org.eclipse.swt.graphics.RGB;
38-
import org.eclipse.swt.widgets.Shell;
39-
import org.eclipse.ui.IWorkbenchPart;
4036
import org.osgi.framework.Bundle;
4137
import org.osgi.framework.FrameworkUtil;
4238

@@ -98,21 +94,10 @@ private int computeBaseRelevance() {
9894
return base;
9995
}
10096

101-
/*
102-
* Copied from org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getInformationControlCreator()
103-
*/
10497
@Override
10598
public @Nullable IInformationControlCreator getInformationControlCreator() {
106-
Shell shell= UI.getActiveShell();
107-
if (shell == null || !BrowserInformationControl.isAvailable(shell))
108-
return null;
109-
11099
if (infoControlCreator == null) {
111-
/*
112-
* see https://bugs.eclipse.org/bugs/show_bug.cgi?id=232024
113-
*/
114-
IWorkbenchPart part = UI.getActivePart();
115-
JavadocHover.PresenterControlCreator presenterControlCreator= new JavadocHover.PresenterControlCreator(part == null ? null : part.getSite());
100+
IInformationControlCreator presenterControlCreator = super.getInformationControlCreator();
116101
infoControlCreator= new JavadocHover.HoverControlCreator(presenterControlCreator, true);
117102
}
118103
return infoControlCreator;
@@ -129,10 +114,14 @@ public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
129114
RGB bgRGB= registry.getRGB("org.eclipse.jdt.ui.Javadoc.backgroundColor"); //$NON-NLS-1$
130115
HTMLPrinter.insertPageProlog(buffer, 0, fgRGB, bgRGB, getCSSStyles());
131116
HTMLPrinter.addPageEpilog(buffer);
132-
return new JavadocBrowserInformationControlInput(null, null, buffer.toString(), 0);
133-
117+
return buffer.toString();
134118
}
135119

120+
@Override
121+
public @NonNull String getInformationDisplayString() {
122+
return item.getLabel();
123+
}
124+
136125
/**
137126
* Returns the style information for displaying HTML (Javadoc) content.
138127
* Copied from org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.getCSSStyles()

0 commit comments

Comments
 (0)