diff --git a/build.gradle.kts b/build.gradle.kts index 7fd16c4f858..3a29b3c9a67 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -80,8 +80,7 @@ dependencies { api("org.eclipse.lsp4j", "org.eclipse.lsp4j.websocket.jakarta", "0.23.1") // 1c-syntax - api("io.github.1c-syntax", "bsl-parser", "0.24.0") { - exclude("com.tunnelvisionlabs", "antlr4-annotations") + api("io.github.1c-syntax", "bsl-parser", "0.25.0") { exclude("com.ibm.icu", "*") exclude("org.antlr", "ST4") exclude("org.abego.treelayout", "org.abego.treelayout.core") @@ -91,7 +90,7 @@ dependencies { api("io.github.1c-syntax", "mdclasses", "0.13.0") api("io.github.1c-syntax", "bsl-common-library", "0.6.0") api("io.github.1c-syntax", "supportconf", "0.14.0") - api("io.github.1c-syntax", "bsl-parser-core", "0.1.0") + api("io.github.1c-syntax", "bsl-parser-core", "0.2.0") // JLanguageTool implementation("org.languagetool", "languagetool-core", languageToolVersion){ diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java index d7a1ede5933..9ee2ef21533 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java @@ -35,6 +35,7 @@ import com.github._1c_syntax.bsl.languageserver.utils.Trees; import com.github._1c_syntax.bsl.parser.BSLParser; import lombok.RequiredArgsConstructor; +import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.RuleNode; import org.antlr.v4.runtime.tree.TerminalNode; import org.apache.commons.lang3.tuple.Pair; @@ -154,13 +155,14 @@ private Optional getRefContextInsideDefAssign(Reference defRef, Refere final var assignment = defNode .map(TerminalNode::getParent) .filter(BSLParser.LValueContext.class::isInstance) - .map(RuleNode::getParent) + .map(ParseTree::getParent) .filter(BSLParser.AssignmentContext.class::isInstance) .map(BSLParser.AssignmentContext.class::cast); return assignment.flatMap(assignContext -> Trees.findTerminalNodeContainsPosition(assignContext, nextRef.getSelectionRange().getStart())) - .map(TerminalNode::getParent); + .map(TerminalNode::getParent) + .map(RuleNode.class::cast); } private static boolean isVarNameOnlyIntoExpression(RuleNode refContext) { @@ -170,7 +172,7 @@ private static boolean isVarNameOnlyIntoExpression(RuleNode refContext) { .filter(node -> node.getChildCount() == 1) .map(RuleNode::getParent) .filter(BSLParser.MemberContext.class::isInstance) - .map(RuleNode::getParent) + .map(ParseTree::getParent) .filter(expression -> expression.getChildCount() == 1) .filter(BSLParser.ExpressionContext.class::isInstance) .isPresent();