diff --git a/build.gradle.kts b/build.gradle.kts index 81dd020..bbcf430 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,7 +27,7 @@ val commonmarkVersion = "0.27.1" dependencies { compileOnly("org.sonarsource.api.plugin", "sonar-plugin-api", "11.3.0.2824") - implementation("io.github.1c-syntax", "bsl-language-server", "0.28.5") { + implementation("io.github.1c-syntax", "bsl-language-server", "0.29.0-rc.1") { exclude("com.contrastsecurity", "java-sarif") exclude("io.sentry", "sentry-logback") exclude("info.picocli", "picocli-spring-boot-starter") @@ -142,7 +142,17 @@ tasks.jar { } tasks.shadowJar { - mergeServiceFiles() // Критично для плагинов Sonar + duplicatesStrategy = DuplicatesStrategy.INCLUDE + mergeServiceFiles() + transform(com.github.jengelman.gradle.plugins.shadow.transformers.AppendingTransformer::class.java) { + resource.set("META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports") + separator.set("\n") + } + transform(com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer::class.java) { + paths.set(setOf("META-INF/org/languagetool/language-module.properties")) + mergeStrategy.set(com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer.MergeStrategy.Append) + mergeSeparator.set(",") + } configurations = listOf(project.configurations["runtimeClasspath"]) archiveClassifier.set("") } diff --git a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java index 410ea5a..dc51425 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java +++ b/src/main/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighter.java @@ -182,7 +182,7 @@ public void highlightToken( var line = token.getLine(); var charPositionInLine = token.getCharPositionInLine(); - String tokenText = token.getText(); + var tokenText = token.getText().stripTrailing(); var range = Ranges.create( line, @@ -533,20 +533,21 @@ private static Set createSdblFunctions() { SDBLLexer.STOREDDATASIZE, SDBLLexer.UUID, SDBLLexer.STRFIND, - SDBLLexer.STRREPLACE + SDBLLexer.STRREPLACE, + SDBLLexer.UNIQUE ); } private static Set createSdblKeywords() { return Set.of( - SDBLLexer.ALL, + SDBLLexer.ADD, SDBLLexer.ALLOWED, SDBLLexer.AND, SDBLLexer.AS, SDBLLexer.ASC, SDBLLexer.AUTOORDER, SDBLLexer.BETWEEN, - SDBLLexer.BY_EN, + SDBLLexer.BY, SDBLLexer.CASE, SDBLLexer.CAST, SDBLLexer.DESC, @@ -556,46 +557,48 @@ private static Set createSdblKeywords() { SDBLLexer.END, SDBLLexer.ESCAPE, SDBLLexer.FALSE, - SDBLLexer.FOR, + SDBLLexer.FOR_UPDATE, SDBLLexer.FROM, - SDBLLexer.FULL, - SDBLLexer.GROUP, + SDBLLexer.FULL_JOIN, + SDBLLexer.FULL_OUTER_JOIN, + SDBLLexer.GROUP_BY, + SDBLLexer.GROUP_BY_GROUPING_SETS, SDBLLexer.HAVING, SDBLLexer.HIERARCHY, - SDBLLexer.HIERARCHY_FOR_IN, + SDBLLexer.IN_HIERARCHY, SDBLLexer.IN, - SDBLLexer.INDEX, - SDBLLexer.INNER, + SDBLLexer.INDEX_BY, + SDBLLexer.INDEX_BY_SETS, + SDBLLexer.INNER_JOIN, SDBLLexer.INTO, SDBLLexer.IS, SDBLLexer.ISNULL, SDBLLexer.JOIN, SDBLLexer.LEFT, + SDBLLexer.LEFT_JOIN, + SDBLLexer.LEFT_OUTER_JOIN, SDBLLexer.LIKE, SDBLLexer.NOT, SDBLLexer.OF, - SDBLLexer.ONLY, - SDBLLexer.ON_EN, + SDBLLexer.ONLY_HIERARCHY, SDBLLexer.OR, - SDBLLexer.ORDER, + SDBLLexer.ORDER_BY, SDBLLexer.OVERALL, - SDBLLexer.OUTER, SDBLLexer.PERIODS, - SDBLLexer.PO_RU, SDBLLexer.REFS, SDBLLexer.RIGHT, + SDBLLexer.RIGHT_JOIN, + SDBLLexer.RIGHT_OUTER_JOIN, SDBLLexer.SELECT, - SDBLLexer.SET, SDBLLexer.THEN, SDBLLexer.TOP, SDBLLexer.TOTALS, SDBLLexer.UNION, - SDBLLexer.UPDATE, + SDBLLexer.UNION_ALL, SDBLLexer.WHEN, SDBLLexer.WHERE, SDBLLexer.EMPTYREF, - SDBLLexer.GROUPEDBY, - SDBLLexer.GROUPING + SDBLLexer.GROUPEDBY ); } diff --git a/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java b/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java index 4ba58df..cc94581 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/sonar/BSLHighlighterTest.java @@ -289,14 +289,14 @@ private Map getHighlightingMapBSL(Vocabulary vocabulary) { private Map getHighlightingMapSDBL(Vocabulary vocabulary) { Set keywords = Set.of( - "ALL", + "ADD", "ALLOWED", "AND", "AS", "ASC", "AUTOORDER", "BETWEEN", - "BY_EN", + "BY", "CASE", "CAST", "DESC", @@ -307,45 +307,47 @@ private Map getHighlightingMapSDBL(Vocabulary vocabulary) { "ESCAPE", "EMPTYREF", "FALSE", - "FOR", + "FOR_UPDATE", "FROM", - "FULL", - "GROUP", + "FULL_JOIN", + "FULL_OUTER_JOIN", + "GROUP_BY", + "GROUP_BY_GROUPING_SETS", "GROUPEDBY", - "GROUPING", "HAVING", "HIERARCHY", - "HIERARCHY_FOR_IN", + "IN_HIERARCHY", "IN", - "INDEX", - "INNER", + "INDEX_BY", + "INDEX_BY_SETS", + "INNER_JOIN", "INTO", "IS", "ISNULL", "JOIN", "LEFT", + "LEFT_JOIN", + "LEFT_OUTER_JOIN", "LIKE", "NOT", "OF", - "ON_EN", + "ONLY_HIERARCHY", "OR", - "ORDER", + "ORDER_BY", "OVERALL", - "OUTER", - "PO_RU", + "PERIODS", + "REFS", "RIGHT", + "RIGHT_JOIN", + "RIGHT_OUTER_JOIN", "SELECT", - "SET", "THEN", "TOP", "TOTALS", "UNION", + "UNION_ALL", "WHEN", - "WHERE", - "ONLY", - "PERIODS", - "REFS", - "UPDATE" + "WHERE" ); Set functions = Set.of( @@ -405,7 +407,8 @@ private Map getHighlightingMapSDBL(Vocabulary vocabulary) { "STOREDDATASIZE", "UUID", "STRFIND", - "STRREPLACE" + "STRREPLACE", + "UNIQUE" ); Set metadataTypes = Set.of( @@ -479,9 +482,7 @@ private Map getHighlightingMapSDBL(Vocabulary vocabulary) { "ROUTEPOINT_FIELD", "IDENTIFIER", "INCORRECT_IDENTIFIER", - "BRACE_IDENTIFIER", - "UNKNOWN", - "BAR" // TODO: Убрать из лексера + "UNKNOWN" ); Set eds = Set.of(