Skip to content

GH-221: Added the encode/decode utility for the highlighting tokens.#223

Merged
spoenemann merged 1 commit intoeclipse-lsp4j:masterfrom
kittaakos:GH-221
Aug 10, 2018
Merged

GH-221: Added the encode/decode utility for the highlighting tokens.#223
spoenemann merged 1 commit intoeclipse-lsp4j:masterfrom
kittaakos:GH-221

Conversation

@kittaakos
Copy link
Contributor

Closes #221.

Signed-off-by: Akos Kitta [email protected]

@kittaakos kittaakos changed the title GH-221: Added the encode/decode utility for the highlighting tokens. [WIP] GH-221: Added the encode/decode utility for the highlighting tokens. Aug 9, 2018
* <ul>
* <li>{@code array[3*i]} is the {@link Token#character character} of the token.</li>
* <li>{@code array[3*i+1]} is the {@link Token#length length} of the token.</li>
* <li>{@code array[3*i]} is the token {@link Token#scope scope}.</li>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Incorrect doc. Should be 3*i+2.

* into a list of tokens. If the input is {@code null}, returns with an empty list.
* Throws an exception if the length of the arguments is not a modulo of {@code 3}.
*/
static def fromIntArray(int... input) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need to an assertion here. The ints cannot exceed the 0 and 232-1 (inclusive) range.

* Returns with an empty string if the {@code tokens} argument is {@code null} or
* empty.
*/
static def String encode(Iterable<? extends Token> tokens) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have to add a encode/decode test with a huge chunk of data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@kittaakos kittaakos changed the title [WIP] GH-221: Added the encode/decode utility for the highlighting tokens. GH-221: Added the encode/decode utility for the highlighting tokens. Aug 9, 2018
@kittaakos
Copy link
Contributor Author

Ready for review.

@svenefftinge
Copy link
Contributor

We use Xtend only for protocol definitions. In other places please use Java.

@kittaakos
Copy link
Contributor Author

I have switched to Java.

* Utility class for encoding and decoding semantic highlighting tokens into a
* compact, {@code base64} representation.
*/
public abstract class SemanticHighlightingTokens {
Copy link
Contributor

Choose a reason for hiding this comment

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

Usually I make such a class final and declare a private default constructor instead of making it abstract. An abstract class looks like something that needs to be implemented in a subclass.

@spoenemann spoenemann merged commit b74ab5f into eclipse-lsp4j:master Aug 10, 2018
@kittaakos kittaakos deleted the GH-221 branch August 10, 2018 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants