Repository navigation
Rework JDT completions via LSP - #1238
Conversation
martinlippert
left a comment
There was a problem hiding this comment.
Tried the changes with our Spring Boot language server in the various situations where we use Spring completions inside of Java source code, seems to work nicely.
| public StyledString getStyledDisplayString() { | ||
| if (Boolean.TRUE.equals(item.getDeprecated())) { | ||
| return new StyledString(getDisplayString(), StyleUtil.DEPRECATE); | ||
| StyledString ss = Boolean.TRUE.equals(item.getDeprecated()) |
There was a problem hiding this comment.
would you mind doing this part of the PR (which I think adds support for completion label details) in a separate PR? That part should be very easy to review then.
| public StyledString getStyledDisplayString() { | ||
| if (Boolean.TRUE.equals(item.getDeprecated())) { | ||
| return new StyledString(getDisplayString(), StyleUtil.DEPRECATE); | ||
| StyledString ss = Boolean.TRUE.equals(item.getDeprecated()) |
There was a problem hiding this comment.
I would rather keep the version isDeprecated() that we had on getStyledDisplayString(document, offset, boldStylerProvider)
| protected int currentOffset = -1; | ||
| protected @Nullable ITextViewer viewer; | ||
| private final IDocument document; | ||
| protected final IDocument document; |
There was a problem hiding this comment.
I am not following this part of the PR. Why does it need to be protected?
There was a problem hiding this comment.
Indeed... was a rogue change... :-\
| Bundle-Name: Language Server Protocol client for Eclipse IDE (Incubation) | ||
| Bundle-SymbolicName: org.eclipse.lsp4e;singleton:=true | ||
| Bundle-Version: 0.18.20.qualifier | ||
| Bundle-Version: 0.19.0.qualifier |
There was a problem hiding this comment.
could not just be 0.18.21 following what we did so far?
|
|
||
| if (infoControlCreator == null) { | ||
| /* | ||
| * FIXME: Take control creators (and link handling) out of JavadocHover, |
There was a problem hiding this comment.
This has been marked as RESOLVED WONTFIX, so probably it will never happen. Should we remove the FIXME and leave the link to the bug report?
There was a problem hiding this comment.
Remove part of the comment
| import org.eclipse.core.runtime.Platform; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.eclipse.jdt.internal.codeassist.RelevanceConstants; | ||
| import org.eclipse.jdt.internal.ui.JavaPlugin; |
There was a problem hiding this comment.
@mickaelistria , should we be avoiding importing internal classes from the JDT or is this something that is not an issue if you are part of the SimRel?
There was a problem hiding this comment.
Yes, better avoiding it (when possible)
| import org.eclipse.core.runtime.Platform; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.eclipse.jdt.internal.codeassist.RelevanceConstants; | ||
| import org.eclipse.jdt.internal.ui.JavaPlugin; |
There was a problem hiding this comment.
Yes, better avoiding it (when possible)
| */ | ||
| @Override | ||
| public @Nullable IInformationControlCreator getInformationControlCreator() { | ||
| Shell shell= JavaPlugin.getActiveWorkbenchShell(); |
There was a problem hiding this comment.
That part can probably be inlined instead of referencing the internal.
| */ | ||
| private @Nullable String getCSSStyles() { | ||
| if (fgCSSStyles == null) { | ||
| Bundle bundle= Platform.getBundle(JavaPlugin.getPluginId()); |
There was a problem hiding this comment.
Would better use FrameworkUtil.getBundle(IJavaEditorTextHover.class) (an API class related to the file we want)
| } | ||
| fgCSSStyles= buffer.toString(); | ||
| } catch (IOException ex) { | ||
| JavaPlugin.log(ex); |
There was a problem hiding this comment.
This error happens in the current bundle, so let's not log it as it it were created by JavaPlugin. Let's log using the current bundle. If using recent enough platform ILog.get().error(ex.getMessage(), ex) should be a good substitute.
d2f8e6a to
52c8f24
Compare
|
@rubenporras I have separated out label details, addressed your comments (Thank you very much for the comments by the way). Also cleaned up a few things. Lets see what else stands out to you :-) |
Support `CompletionItem` `LabelDetails` object Separated from #1238
Rework naive implementation of LSP completions for Java Editor