Skip to content

Commit 1e84f4d

Browse files
committed
fix: Avoid using IElementType#getDebugName() internal method
Signed-off-by: azerr <[email protected]>
1 parent b6e4f28 commit 1e84f4d

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

src/main/java/com/redhat/devtools/intellij/qute/run/QuteDebugAdapterVariableSupport.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
*/
3434
public class QuteDebugAdapterVariableSupport extends DebugAdapterVariableSupport {
3535

36-
public static final String QUTE_JETBRAINS_IDENTIFIER = "IDENTIFIER";
37-
public static final String QUTE_JETBRAINS_IDENTIFIER_EXPR = "IDENTIFIER_EXPR";
38-
public static final String QUTE_JETBRAINS_REFERENCE_EXPR = "REFERENCE_EXPR";
39-
public static final String QUTE_JETBRAINS_NAMESPACE_EXPR = "NAMESPACE_EXPR";
40-
public static final String QUTE_JETBRAINS_QUALIFIER = "QUALIFIER";
41-
public static final String QUTE_JETBRAINS_CALL_EXPR = "CALL_EXPR";
36+
public static final String QUTE_JETBRAINS_IDENTIFIER = "QuteTokenType.IDENTIFIER";
37+
private static final String QUTE_JETBRAINS_IDENTIFIER_EXPR = "QuteElementType.IDENTIFIER_EXPR";
38+
private static final String QUTE_JETBRAINS_REFERENCE_EXPR = "QuteElementType.REFERENCE_EXPR";
39+
private static final String QUTE_JETBRAINS_NAMESPACE_EXPR = "QuteElementType.NAMESPACE_EXPR";
40+
private static final String QUTE_JETBRAINS_QUALIFIER = "QuteElementType.QUALIFIER";
41+
private static final String QUTE_JETBRAINS_CALL_EXPR = "QuteElementType.CALL_EXPR";
4242

4343
@Override
4444
public @NotNull Collection<DebugVariablePositionProvider> getDebugVariablePositionProvider() {
@@ -117,8 +117,8 @@ public class QuteDebugAdapterVariableSupport extends DebugAdapterVariableSupport
117117
return node != null ? node.getElementType() : null;
118118
}
119119

120-
private static boolean isTokenType(@Nullable IElementType tokenType, @NotNull String tokenName) {
121-
return tokenType != null && tokenName.equals(tokenType.getDebugName());
120+
public static boolean isTokenType(@Nullable IElementType tokenType, @NotNull String tokenName) {
121+
return tokenType != null && tokenName.equals(tokenType.toString());
122122
}
123123

124124
}

src/main/java/com/redhat/devtools/intellij/qute/run/QuteVariableRangeRegistrar.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import com.redhat.devtools.lsp4ij.dap.client.variables.providers.DefaultVariableRangeRegistrar;
2020
import org.jetbrains.annotations.NotNull;
2121

22+
import static com.redhat.devtools.intellij.qute.run.QuteDebugAdapterVariableSupport.QUTE_JETBRAINS_IDENTIFIER;
23+
import static com.redhat.devtools.intellij.qute.run.QuteDebugAdapterVariableSupport.isTokenType;
24+
2225
/**
2326
* Qute variable range registar.
2427
*/
@@ -32,7 +35,7 @@ public boolean tryRegisterVariableRange(@NotNull IElementType tokenType, int sta
3235
context.addVariableRange(variableName, textRange);
3336
} else if (QuteLanguage.isQuteLanguage(tokenType.getLanguage())) {
3437
if (!(tokenType instanceof QuteTokenType)) {
35-
if (QuteDebugAdapterVariableSupport.QUTE_JETBRAINS_IDENTIFIER.equals(tokenType.getDebugName())) {
38+
if (isTokenType(tokenType, QUTE_JETBRAINS_IDENTIFIER)) {
3639
TextRange textRange = new TextRange(start, end);
3740
String variableName = document.getText(textRange);
3841
context.addVariableRange(variableName, textRange);

0 commit comments

Comments
 (0)