Skip to content

GH-715: Implemented the semantic highlighting support. - #746

Merged
fbricon merged 1 commit into
eclipse-jdtls:masterfrom
kittaakos:GH-715
Oct 19, 2018
Merged

GH-715: Implemented the semantic highlighting support.#746
fbricon merged 1 commit into
eclipse-jdtls:masterfrom
kittaakos:GH-715

Conversation

@kittaakos

@kittaakos kittaakos commented Aug 7, 2018

Copy link
Copy Markdown

This PR contains the following change:

  • Enables the semantic highlighting for the JDT LS.
  • Switches from LSP4J 0.4.0 to 0.5.0.

Static:
static_member

Member vs. Parameter:
member-vs-parameter

Deprecated:
deprecated

Auto (un)boxing:
autoboxing

Closes #715.

Signed-off-by: Akos Kitta kittaakos@typefox.io

@kittaakos kittaakos changed the title [WIP] Initial changes to support semantic highlighting Initial changes to support semantic highlighting Aug 7, 2018
@kittaakos kittaakos changed the title Initial changes to support semantic highlighting GH-715: Implemented the semantic highlighting support. Aug 7, 2018
@fbricon

fbricon commented Aug 7, 2018

Copy link
Copy Markdown
Contributor

@kittaakos thanks for the PR that looks promising! I'll review as soon as I can

@kittaakos

Copy link
Copy Markdown
Author

I will shrink the size of this PR once eclipse-lsp4j/lsp4j#223 will be accepted and merged.

@fbricon
fbricon requested a review from snjeza August 10, 2018 22:59
@snjeza

snjeza commented Aug 10, 2018

Copy link
Copy Markdown
Contributor

test this please

@snjeza

snjeza commented Aug 10, 2018

Copy link
Copy Markdown
Contributor

I will shrink the size of this PR once eclipse-lsp4j/lsp4j#223 will be accepted and merged.

@kittaakos eclipse-lsp4j/lsp4j#223 has been merged.

@snjeza

snjeza commented Aug 12, 2018

Copy link
Copy Markdown
Contributor

The target platform is built from a fork of the original LSP4J source to enable the semantic highlighting capabilities.

@kittaakos Do I need to use any particular versions of VS Code?

@kittaakos

Copy link
Copy Markdown
Author

Do I need to use any particular versions of VS Code?

Currently, VS Code does not expose a theming API. See here. You can try it out in Eclipse Theia; it already uses the forked JDT language server.

@snjeza snjeza left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine in Eclipse Theia.

@fbricon

fbricon commented Aug 20, 2018

Copy link
Copy Markdown
Contributor

Can we rename the org.eclipse.jdt.ls.core.internal.semantichighlight package to org.eclipse.jdt.ls.core.internal.highlighting? semantichighlight burns my eyes :-)

@kittaakos

Copy link
Copy Markdown
Author

semantichighlight burns my eyes :-)

Sure. I do the updates here, once there is a new release of lsp4j. So that I can get rid of a bunch of classes, custom target platform files and so on. The release will happen either this or next week.

@kittaakos
kittaakos force-pushed the GH-715 branch 3 times, most recently from 364f971 to c8ce2b8 Compare August 27, 2018 14:02
@kittaakos

Copy link
Copy Markdown
Author

I did the followings:

  • Switched to 0.5.0.M1 of LSP4J. (Adapted the codeAction and documentSymbol API to compile.)
  • Got rid of a bunch of obsolete utility classes and the custom target platform.
  • Renamed org.eclipse.jdt.ls.core.internal.semantichighlight to org.eclipse.jdt.ls.core.internal.highlighting.

@fbricon

fbricon commented Aug 28, 2018

Copy link
Copy Markdown
Contributor

@kittaakos could you extract the launcher/debugger stuff in a separate PR please, it's orthogonal to the issue and will be faster to get in

@kittaakos

Copy link
Copy Markdown
Author

could you extract the launcher/debugger stuff in a separate PR please

Sure.

@kittaakos
kittaakos force-pushed the GH-715 branch 4 times, most recently from 720550d to fae85af Compare August 30, 2018 14:40
@kittaakos

Copy link
Copy Markdown
Author

could you extract the launcher/debugger stuff in a separate PR please

@fbricon, I got rid of the non-highlighting related changes.

@kittaakos

Copy link
Copy Markdown
Author

Are there any updates, feedback on this PR?

@svenefftinge

Copy link
Copy Markdown

Would be really nice to get this merged. It works nicely with Theia now.
And we currently need to ship Theia with a fork.

@fbricon fbricon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for the copyright headers to fix, I only have a few minor remarks. But that's a pretty good patch overall.

Anyways, we'll have to open a CQ for that, which may take a few days to get approved.

<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.lsp4j.sdk.feature.group" version="0.4.0.v20180425-1137"/>
<repository location="http://download.eclipse.org/lsp4j/updates/releases/"/>
<unit id="org.eclipse.lsp4j.sdk.feature.group" version="0.5.0.v20180822-0752"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TP is pointing to 0.5.0.M1 in master

@@ -0,0 +1,245 @@
/*******************************************************************************
* Copyright (c) 2018 Red Hat Inc. and others.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Red Hat Inc./TypeFox/g

IDocument document = JsonRpcHelpers.toDocument(unit.getBuffer());
edit.apply(document, TextEdit.NONE);

// Avoid any computation iff the `SemanticHighlightingService#isEnabled` is `false`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/iff/if

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for completeness with the source:
"[...]In logic and related fields such as mathematics and philosophy, if and only if (shortened iff) is a biconditional logical connective between statements.[...]"

Since it was not obvious whether it is a typo or not, I apply the recommended change. Thanks for the feedback.

@@ -27,6 +27,7 @@
import java.util.concurrent.Executors;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lsp4j 0.5.0 compat changes already available in master

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not understand this. Wha do you mean by this comment?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just that those changes aren't necessary anymore, as they ve already been taken care of. Just needs to rebase against master

@@ -0,0 +1,72 @@
/*******************************************************************************
* Copyright (c) 2018 TypeFox and others.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if file was copied from jdt, then it should retain the original copyright from IBM.

Add Contributors section:

 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     TypeFox - port to jdt.ls

infos.put(line, new SemanticHighlightingTokens.Token(character, length, scope));
}
//@formatter:off
return FluentIterable.from(infos.asMap().entrySet())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java Streams instead?

import org.eclipse.lsp4j.VersionedTextDocumentIdentifier;
import org.eclipse.lsp4j.util.SemanticHighlightingTokens;

import com.google.common.base.Preconditions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eclipse Assert?

@@ -0,0 +1,117 @@
/*******************************************************************************
* Copyright (c) 2018 TypeFox and others.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if file was copied from jdt, then it should retain the original copyright from IBM.

Add Contributors section:

 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     TypeFox - port to jdt.ls


public boolean isSemanticHighlightingSupported() {
TextDocumentClientCapabilities textDocument = capabilities.getTextDocument();
if (textDocument == null) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use v3supported instead

@kittaakos

Copy link
Copy Markdown
Author

Thank you for the review, @fbricon. I have updated this PR based on your feedback.

@fbricon

fbricon commented Sep 13, 2018

Copy link
Copy Markdown
Contributor

Opened CQ https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17560

@fbricon

fbricon commented Sep 28, 2018

Copy link
Copy Markdown
Contributor

@jjohnstn is everything available in jdt.core now so that we can drop the copied files?

Closes eclipse-jdtls#715.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
@fbricon

fbricon commented Oct 19, 2018

Copy link
Copy Markdown
Contributor

test this please

@fbricon
fbricon merged commit b834f12 into eclipse-jdtls:master Oct 19, 2018
@jjohnstn

Copy link
Copy Markdown
Contributor

@jjohnstn is everything available in jdt.core now so that we can drop the copied files?

Still in review. https://git.eclipse.org/r/#/c/129807/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants