use of org.eclipse.lsp4j.SemanticTokens in project magik-tools by StevenLooman.
the class SemanticTokenProviderTest method testLocalsDefinition.
@Test
void testLocalsDefinition() {
final String code = "_local (a, b) << (1, 2)";
final SemanticTokens semanticTokens = this.getSemanticTokens(code);
assertThat(semanticTokens.getData()).containsExactly(0, 0, "_local".length(), SemanticToken.Type.KEYWORD.getTokenType(), 0, 0, 8, "a".length(), SemanticToken.Type.VARIABLE.getTokenType(), 0, 0, 3, "b".length(), SemanticToken.Type.VARIABLE.getTokenType(), 0, 0, 3, "<<".length(), SemanticToken.Type.OPERATOR.getTokenType(), 0, 0, 4, "1".length(), SemanticToken.Type.NUMBER.getTokenType(), 0, 0, 3, "2".length(), SemanticToken.Type.NUMBER.getTokenType(), 0);
}
use of org.eclipse.lsp4j.SemanticTokens in project magik-tools by StevenLooman.
the class SemanticTokenProviderTest method testParameter.
@Test
void testParameter() {
final String code = "_proc(x) x _endproc";
final SemanticTokens semanticTokens = this.getSemanticTokens(code);
assertThat(semanticTokens.getData()).containsExactly(0, 0, "_proc".length(), SemanticToken.Type.KEYWORD.getTokenType(), 0, 0, 6, "x".length(), SemanticToken.Type.PARAMETER.getTokenType(), 0, 0, 3, "x".length(), SemanticToken.Type.PARAMETER.getTokenType(), 0, 0, 2, "_endproc".length(), SemanticToken.Type.KEYWORD.getTokenType(), 0);
}
use of org.eclipse.lsp4j.SemanticTokens in project magik-tools by StevenLooman.
the class SemanticTokenProviderTest method testKeyword.
@Test
void testKeyword() {
final String code = "a _is b";
final SemanticTokens semanticTokens = this.getSemanticTokens(code);
final int varGlobalModifier = SemanticToken.Modifier.VARIABLE_GLOBAL.getModifierType();
assertThat(semanticTokens.getData()).containsExactly(0, 0, "a".length(), SemanticToken.Type.VARIABLE.getTokenType(), varGlobalModifier, 0, 2, "_is".length(), SemanticToken.Type.KEYWORD.getTokenType(), 0, 0, 4, "b".length(), SemanticToken.Type.VARIABLE.getTokenType(), varGlobalModifier);
}
use of org.eclipse.lsp4j.SemanticTokens in project magik-tools by StevenLooman.
the class SemanticTokenProviderTest method testSelfReadonly.
@Test
void testSelfReadonly() {
final String code = "_self";
final SemanticTokens semanticTokens = this.getSemanticTokens(code);
final int readonlyModifier = SemanticToken.Modifier.READONLY.getModifierType();
assertThat(semanticTokens.getData()).containsExactly(0, 0, "_self".length(), SemanticToken.Type.VARIABLE.getTokenType(), readonlyModifier);
}
use of org.eclipse.lsp4j.SemanticTokens in project magik-tools by StevenLooman.
the class SemanticTokenProviderTest method testSymbol.
@Test
void testSymbol() {
final String code = ":string";
final SemanticTokens semanticTokens = this.getSemanticTokens(code);
assertThat(semanticTokens.getData()).containsExactly(0, 0, ":string".length(), SemanticToken.Type.STRING.getTokenType(), 0);
}
Aggregations