Переход на использование чтения описания методов и переменных bsl-parser#3753
Conversation
|
Caution Review failedThe pull request is closed. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughRemoved local description/model/parsing code and migrated usages to the bsl-parser dependency; call sites updated to import parser-provided description types, use factory methods, and adapt to SimpleRange/fields/links APIs. Changes
Sequence Diagram(s)sequenceDiagram
actor Client
participant LanguageServer
participant Workspace as WorkspaceDB
participant ParserLib as bsl-parser
Client->>LanguageServer: Request hover / diagnostics / semantic tokens
LanguageServer->>Workspace: Locate symbol & source tokens
LanguageServer->>ParserLib: Description.create(tokens) / request description elements
ParserLib-->>LanguageServer: Description, DescriptionElements, SimpleRange, Links, Fields
LanguageServer->>LanguageServer: Build hover markup, diagnostics, semantic tokens
LanguageServer-->>Client: Return hover / diagnostics / semantic tokens
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Results 2 817 files 2 817 suites 1h 3m 6s ⏱️ Results for commit b051209. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
This pull request migrates from internal method and variable description parsing to using the bsl-parser library (v0.30.0-rc.1). The change removes ~550 lines of duplicate parsing logic and delegates description reading to the upstream bsl-parser library.
Changes:
- Removed internal description classes (MethodDescription, VariableDescription, TypeDescription, ParameterDescription, DescriptionReader) in favor of bsl-parser equivalents
- Updated semantic token supplier to use new description element API instead of re-parsing with tokenizer
- Removed "call options" section support (now merged with examples)
- Updated all imports and API calls throughout the codebase
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle.kts | Updated bsl-parser to 0.30.0-rc.1 and bsl-common-library to 0.9.2 |
| DescriptionFormatter.java | Refactored to use new HyperlinkTypeDescription API; removed getCallOptionsSection method |
| BslDocSemanticTokensSupplier.java | Simplified to use getElements() API instead of re-tokenizing descriptions |
| SemanticTokensHelper.java | Added addDescriptionElement method for new description element type |
| CommentSemanticTokensSupplier.java | Updated to use SimpleRange instead of org.eclipse.lsp4j.Range |
| MissingReturnedValueDescriptionDiagnostic.java | Updated API calls: getLink() → getLinks(), parameters() → fields() |
| MissingParameterDescriptionDiagnostic.java | Updated API call: getLink() → getLinks() |
| LineLengthDiagnostic.java | Updated to use SimpleRange |
| VariableSymbolComputer.java | Updated to use VariableDescription.create() factory method |
| MethodSymbolComputer.java | Updated to use MethodDescription.create() factory method |
| Multiple symbol classes | Updated imports from internal to bsl-parser description classes |
| Test files | Updated expectations for new API behavior (examples as String, type ordering changes, new hyperlink detection) |
| MethodDescription.bsl | Moved "Варианты вызова" lines to "Пример" section reflecting parser changes |
…escriptionFormatter.java Co-authored-by: Copilot <[email protected]>
99847dd to
dee6e84
Compare
|
@coderabbitai |
|
@theshadowco: Конечно, провожу ревью изменений в PR #3753. Обратите внимание, что в описании PR отсутствует номер задачи после "Closes" — рекомендую добавить ссылку на соответствующий issue. 🧠 Learnings used✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
@src/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/BslDocSemanticTokensSupplier.java:
- Around line 26-27: Remove the unused import BSLDescriptionLexer from
BslDocSemanticTokensSupplier (the import at the top that reads
BSLDescriptionLexer); the class BslDocSemanticTokensSupplier no longer
references that type, so delete the import line and run your IDE's
optimize/imports or build to ensure no other unused imports remain.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/test/resources/context/symbol/MethodDescription.bslis excluded by!src/test/resources/**
📒 Files selected for processing (34)
build.gradle.ktssrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationParamSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/Describable.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ParameterDefinition.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/VariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescription.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/SourceDefinedSymbolDescription.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/package-info.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedMethodCallDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/BslDocSemanticTokensSupplier.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/CommentSemanticTokensSupplier.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/SemanticTokensHelper.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/hover/MethodSymbolMarkupContentBuilderTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.java
💤 Files with no reviewable changes (7)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.java
- src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java
- src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/SourceDefinedSymbolDescription.java
- src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java
- src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java
- src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/package-info.java
- src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescription.java
🧰 Additional context used
📓 Path-based instructions (5)
src/main/java/**/*.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
src/main/java/**/*.java: Follow the Style Guide for code formatting and conventions
Use Lombok annotations to reduce boilerplate code and enable annotation processing in IDE
Write JavaDoc for public APIs and include comments for complex logic
Use meaningful, descriptive names for classes and methods following Java naming conventions
Optimize imports before committing; DO NOT optimize imports across the entire project unless specifically working on that task
Files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationParamSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/Describable.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/CommentSemanticTokensSupplier.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/VariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/SemanticTokensHelper.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedMethodCallDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/BslDocSemanticTokensSupplier.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ParameterDefinition.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java
src/**/*.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Java 17 for language and follow Java naming conventions
Files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationParamSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/Describable.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/CommentSemanticTokensSupplier.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/VariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/SemanticTokensHelper.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationSymbol.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedMethodCallDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/BslDocSemanticTokensSupplier.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/hover/MethodSymbolMarkupContentBuilderTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ParameterDefinition.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java
src/test/java/**/*Test.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Maintain or improve test coverage and use appropriate test frameworks (JUnit, AssertJ, Mockito)
Files:
src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/hover/MethodSymbolMarkupContentBuilderTest.java
src/main/java/**/diagnostics/**/*.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Each diagnostic should have: Java implementation class, resource bundle for localized messages, unit tests, and documentation
Files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedMethodCallDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java
src/test/java/**/diagnostics/**/*Test.java
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Write comprehensive unit tests for each diagnostic including edge cases, following existing test patterns
Files:
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.java
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.712Z
Learning: Applies to docs/{en/,}diagnostics/**/*.md : Update diagnostic documentation in both Russian and English with examples of problematic code and fixes
📚 Learning: 2025-12-28T11:15:32.357Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 0
File: :0-0
Timestamp: 2025-12-28T11:15:32.357Z
Learning: In PR #3706 about semantic token optimization, I incorrectly stated that the algorithm in findSuffixMatchWithOffset correctly handles inline text insertions (text insertion without line breaks). The actual bug is that when lineOffset=0, tokens after the insertion point have the same deltaLine but different deltaStart, and the old algorithm failed to match them because it checked deltaStart equality. PR #3707 fixes this by allowing deltaStart to differ for the boundary token when lineOffset==0.
Applied to files:
src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.java
📚 Learning: 2025-12-18T18:49:48.712Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.712Z
Learning: Applies to docs/{en/,}diagnostics/**/*.md : Update diagnostic documentation in both Russian and English with examples of problematic code and fixes
Applied to files:
src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.java
📚 Learning: 2025-11-19T09:02:03.154Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3610
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/QueryPackageFoldingRangeSupplier.java:26-26
Timestamp: 2025-11-19T09:02:03.154Z
Learning: В проекте bsl-language-server используется кастомная версия ANTLR4 от 1c-syntax (io.github.1c-syntax:antlr4), которая включает базовый класс org.antlr.v4.runtime.Tokenizer с методами getAst() и getTokens(). SDBLTokenizer и BSLTokenizer наследуются от этого базового класса.
Applied to files:
src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/BslDocSemanticTokensSupplier.java
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.
Applied to files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolComputer.java
📚 Learning: 2025-12-18T18:49:48.712Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.712Z
Learning: Applies to src/main/java/**/diagnostics/**/*.java : Each diagnostic should have: Java implementation class, resource bundle for localized messages, unit tests, and documentation
Applied to files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.
Applied to files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java
📚 Learning: 2025-01-19T21:34:39.797Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T21:34:39.797Z
Learning: In BSL Language Server configuration classes, immutable collections (Set.of, List.of) should be used for default values, while mutability is achieved through setters generated by Data annotation.
Applied to files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java
📚 Learning: 2025-02-10T17:12:56.150Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:63-66
Timestamp: 2025-02-10T17:12:56.150Z
Learning: In BSL Language Server, `documentContext.getServerContext().getConfiguration()` is guaranteed to return a non-null value, making null checks unnecessary.
Applied to files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/BslDocSemanticTokensSupplier.java
📚 Learning: 2025-12-18T18:49:48.712Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.712Z
Learning: Applies to src/test/java/**/diagnostics/**/*Test.java : Write comprehensive unit tests for each diagnostic including edge cases, following existing test patterns
Applied to files:
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.java
📚 Learning: 2025-02-10T17:13:41.452Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:54-58
Timestamp: 2025-02-10T17:13:41.452Z
Learning: In ProtectedModuleDiagnostic.java, the usage of `Range` field as a diagnostic target is accepted as is, despite being marked as a temporary solution in the comments.
Applied to files:
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java
📚 Learning: 2025-01-19T21:44:32.675Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java:47-47
Timestamp: 2025-01-19T21:44:32.675Z
Learning: В классах-наследниках AbstractRunTestsCodeLensSupplier метод getSelf() должен возвращать this вместо использования Spring-based self-reference, чтобы избежать проблем с циклическими зависимостями и timing issues при тестировании.
Applied to files:
src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Analyse
- GitHub Check: build
- GitHub Check: build (21, ubuntu-latest)
- GitHub Check: build (21, macOS-latest)
- GitHub Check: build (25, windows-latest)
- GitHub Check: build (17, macOS-latest)
- GitHub Check: build (25, ubuntu-latest)
- GitHub Check: build (17, windows-latest)
- GitHub Check: build (25, macOS-latest)
- GitHub Check: build (21, windows-latest)
- GitHub Check: build (17, ubuntu-latest)
- GitHub Check: Sentry
🔇 Additional comments (62)
src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java (13)
26-28: LGTM!The imports correctly reference the new
com.github._1c_syntax.bsl.parser.descriptionpackage, aligning with the PR's objective to migrate description parsing to the bsl-parser dependency.
86-86: LGTM!Correctly migrated from
getLink()(single optional) togetLinks()(collection), with appropriateisEmpty()assertion.
124-124: LGTM!API change from
parameters()tofields()is correctly applied for accessing type description sub-elements.
138-145: LGTM!The test properly validates the new
HyperlinkTypeDescriptiontype:
- Uses
instanceofcheck before casting (safe pattern)- Correctly accesses
hyperlink()on the cast type- Uses
Hyperlink.create()factory method for expected value comparison
158-164: LGTM!Test correctly validates hyperlink parameters with the new API, including the additional
types().hasSize(1)assertion that improves test coverage.
178-178: LGTM!Correctly uses
contains()assertion for the collection-basedgetLinks()API.
217-223: Verify the expected counts align with the new parser behavior.The expected sizes for
getExamples()(73) andgetCallOptions()(103) have changed significantly. Ensure these values correctly reflect the new bsl-parser's description parsing logic and are not a regression.
246-252: LGTM!Test expectations updated to reflect the new parser's example extraction behavior.
283-288: LGTM!Assertions correctly updated for the new call options parsing behavior.
300-428: LGTM!Comprehensive test coverage for nested type structures with consistent API migration from
parameters()tofields(). The changes to type names (e.g.,"Массив<Структура>") and description value shifts reflect the new parser's improved handling of parameterized types.
192-192: LGTM!Consistent
getLinks()API usage.
265-273: LGTM!The
fields()accessor is correctly used for type description sub-elements throughout testMethod4.
444-444: LGTM!Final test method correctly updated for the
getLinks()API.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java (1)
26-26: Import migration looks correct.The import of
VariableDescriptionis correctly updated to the newcom.github._1c_syntax.bsl.parser.descriptionpackage, consistent with the broader refactor migrating description types to the bsl-parser dependency.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ParameterDefinition.java (1)
26-26: Import migration is consistent with the refactor.The
ParameterDescriptionimport correctly points to the newcom.github._1c_syntax.bsl.parser.descriptionpackage, aligning with the migration of description types to the parser library.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java (3)
36-37: Import migration to parser.description package.The imports for
MethodDescriptionandParameterDescriptionare correctly updated to the newcom.github._1c_syntax.bsl.parser.descriptionpackage.
231-238: Factory method usage for MethodDescription creation is correct.The change from constructor instantiation to
MethodDescription.create(comments)factory method aligns with the new API inbsl-parser(version 0.30.0-rc.2). The factory method signature correctly acceptsList<Token>and returnsMethodDescription, which is properly wrapped inOptional.of()to match the method's return type. This is a clean approach that encapsulates the creation logic within the parser library.
321-330: No action required. TheMethodDescription.getParameters()API returns a collection ofParameterDescriptionobjects with accessiblename()method. This contract is already validated across 40+ usages throughout the codebase and test coverage exists. No compatibility issues are evident.src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.java (4)
421-425: Test expectations updated for consolidated documentation tokens.The token expectations correctly reflect the new tokenization behavior where documentation fragments like
" - "and" - описание"are now represented as single Comment tokens instead of being split into multiple tokens. This aligns with the parser.description migration that consolidates documentation parsing.
510-514: Consistent consolidation of parameter description tokens.The test correctly expects consolidated Comment tokens for documentation fragments in parameter descriptions. The length values (3 for
" - ", 19 for" - имя пользователя") accurately reflect the single-token representation.
520-524: Parameter documentation token expectations aligned.These changes maintain consistency with the consolidated tokenization approach for
" - "separators and trailing descriptions like" - возраст".
536-536: Return value description token consolidated.The return value documentation
" - результат проверки"is correctly expected as a single Comment token with length 21, consistent with the other documentation fragment changes.build.gradle.kts (2)
85-85: > Likely an incorrect or invalid review comment.
92-92: Minor version bump for bsl-common-library looks appropriate.The update from
0.9.1to0.9.2is a patch version increment introducing new types, which is backward compatible.src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/MethodSymbolMarkupContentBuilderTest.java (1)
71-118: Test expectations correctly updated for the bsl-parser migration.The test assertions have been updated to reflect the new formatting output from the bsl-parser description classes. Key changes include:
- Method signature now shows inline parameter types (Line 73)
- Parameter descriptions use non-breaking spaces (
) for alignment (Lines 82-84)- Link format simplified from
[См. ОбщийМодуль.СуперМетод()]to[ОбщийМодуль.СуперМетод](Line 99)- Return value block restructured with different indentation (Lines 110-116)
These changes maintain test coverage for the hover functionality with the new parser-based descriptions.
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java (1)
26-26: LGTM!The import change correctly migrates
VariableDescriptionto the bsl-parser package. The class's functionality remains unchanged as the type is only used in the constructor parameter and passed to the parent class.src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java (1)
27-27: LGTM!The import migration is correct. The code continues to use
getPurposeDescription()andgetTrailingDescription()methods fromVariableDescription- these APIs are expected to be available in the bsl-parser package version.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationParamSymbol.java (1)
25-25: LGTM!The import change correctly aligns with the broader migration. The
MethodDescriptiontype is used for thedescriptionfield and obtained fromMethodSymbol.getDescription(), which should also return the parser-based type after this PR.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.java (1)
36-36: Import migration to bsl-parser library is correct.The import change aligns with a coordinated codebase refactoring—11 files across the project have been migrated to use
com.github._1c_syntax.bsl.parser.description.MethodDescription. Thecontains(first, last)method usage at line 169 is consistent with the external parser library's API, confirmed by successful test coverage in MethodDescriptionTest.java.src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnosticTest.java (1)
62-76: LGTM!The test correctly expands coverage to include a new diagnostic case for the complex type
ФайловаяСистемаКлиент.ПараметрыЗагрузкиФайла. The assertion follows the existing test pattern and validates that the migration to bsl-parser properly detects this additional scenario.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AnnotationSymbol.java (1)
25-25: LGTM!The import migration from the local
descriptionpackage tocom.github._1c_syntax.bsl.parser.description.MethodDescriptionaligns with the PR objective to centralize description types in the parser library.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/Describable.java (1)
24-24: LGTM!The import migration for
SourceDefinedSymbolDescriptionis consistent with the centralization of description types in the parser library. The interface contract remains unchanged.src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.java (2)
29-30: LGTM!The imports correctly reflect the migration:
VariableDescriptionnow comes from the parser library, andSimpleRangeis the parser's range representation used for description ranges.
99-117: LGTM!The assertions are correctly updated to use
SimpleRange.create()forVariableDescriptionranges while keepingRanges.create()for LSP4J-basedVariableSymbolranges. This properly reflects the separation between parser-level types (SimpleRange) and language server types (Range).src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DeprecatedMethodCallDiagnostic.java (1)
32-32: LGTM! The import migration tocom.github._1c_syntax.bsl.parser.description.SourceDefinedSymbolDescriptionis correct, and thegetDeprecationInfo()method call at line 71 is compatible with the parser library's implementation. Tests confirm the method works as expected.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java (2)
30-31: LGTM!Import updates correctly reference the new
com.github._1c_syntax.bsl.parser.descriptionpackage as part of the migration from local description classes to the parser library.
85-88: LGTM!API adaptation from
getLink()togetLinks()correctly handles the transition from a single link to a collection of links. The logic remains intact—treating presence of any link as sufficient documentation.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (1)
28-28: LGTM!Import update correctly migrates
MethodDescriptiondependency to the parser library. The field declaration and usage remain unchanged.src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.java (3)
30-31: LGTM!Import updates correctly reference the new
com.github._1c_syntax.bsl.parser.descriptionpackage forMethodDescriptionandTypeDescription.
88-91: LGTM!API adaptation from
getLink()togetLinks()is consistent with the migration pattern across the codebase.
102-106: No action required—the current implementation is correct.The code uses
typeDescription.fields().isEmpty(), which is the correct API for accessing nested type structure in theTypeDescriptioninterface from the bsl-parser library. The logic properly filters for simple types lacking both description and nested fields. This implementation is validated by comprehensive test coverage inMethodDescriptionTest.javaand consistent usage throughout the codebase.Likely an incorrect or invalid review comment.
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java (2)
32-33: LGTM!Import updates correctly reference
MethodDescriptionfrom the parser library and addSimpleRangefor lightweight range handling.
148-162: LGTM!The migration from
RangetoSimpleRangeis implemented correctly:
- Line offset handling (
+1) properly accounts for 0-basedSimpleRangevs 1-based token line numbers- Record accessor syntax (
startLine(),endLine()) replaces getter methodsSimpleRange.containsRangeandSimpleRange.create(token)provide equivalent functionalitysrc/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (1)
26-26: LGTM!Import update correctly migrates
VariableDescriptiondependency to the parser library. The field declaration and usage pattern remain unchanged.src/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/CommentSemanticTokensSupplier.java (3)
27-30: LGTM! Import migration to parser.description package.The imports are correctly updated to use the parser-based description types and SimpleRange for range operations related to description handling.
81-104: LGTM! Correct migration to SimpleRange for description range tracking.The code correctly:
- Uses
SimpleRangefor tracking description ranges (line 81)- Creates comment ranges via
SimpleRange.create(commentToken)(line 101)- Uses
SimpleRange.containsRange()for containment checks (line 104)The continued use of
Ranges.create()inaddSingleLineCommentTokens(line 126) andaddMultilineCommentTokens(line 162) is appropriate since those methods feed intohelper.addRange()which expects LSPRangeobjects.
181-186: LGTM! Updated method signature and isEmpty check.The method signature correctly accepts
List<SimpleRange>and usesrange.isEmpty()instead ofRanges.isEmpty(range). TheSimpleRange.isEmpty()instance method is correctly called on the range object returned fromdescription.getRange().src/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/SemanticTokensHelper.java (2)
24-24: LGTM! Import updated for new description element model.The import correctly reflects the shift from AST-based
TerminalNodeto the data-drivenDescriptionElementapproach.
167-173: LGTM! Clean implementation using DescriptionElement.The new
addDescriptionElementmethod properly extracts range information from the element and delegates toaddEntry. This is more direct than the previousTerminalNode-based approach.Note: Unlike
addTokenRangewhich has a null check (line 142), this method assumes non-null elements. If callers may pass null elements, consider adding@Nullableannotation and a null guard.src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolComputer.java (5)
34-34: LGTM! Import updated to parser.description package.The import correctly points to the migrated
VariableDescriptionclass in the parser library.
237-239: LGTM! Factory method usage for VariableDescription.Correctly using
VariableDescription.create(Collections.emptyList(), trailingComments)instead of the constructor, consistent with the migration to the parser library's factory-based API.
249-251: LGTM!Consistent factory method usage for ForEachStatement context.
261-263: LGTM!Consistent factory method usage for ForStatement context.
282-282: LGTM!Factory method correctly passes both
commentsandtrailingCommentsfor module/sub variable declarations that may have leading comments.src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (5)
30-33: LGTM! Import updates for parser.description migration.Imports correctly updated to reference types from the parser library, including the new
HyperlinkTypeDescriptionfor hyperlink type handling.
122-127: Simplified call options section handling.Same pattern as examples - expects
getCallOptions()to return a singleStringrather than a collection.
322-326: LGTM! Pattern matching for hyperlink type detection.Using
instanceof HyperlinkTypeDescriptionwith pattern variable extraction is cleaner than the previoustype.isHyperlink()approach and directly provides access to thehyperlink()method.
353-358: API accessor change from parameters() to fields().The
TypeDescriptionAPI now usesfields()instead ofparameters()to access nested field descriptions. This naming better reflects that these represent structured type fields rather than method parameters.
114-119: Simplified examples section handling.The implementation correctly expects
getExamples()to return a singleString(not a collection). The logic:
- Filters empty strings using
.isEmpty()- Wraps non-empty content in a code fence with the localized header
This aligns with the parser library's API where examples are pre-concatenated into a single string.
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/VariableSymbol.java (1)
25-25: LGTM! Import migration for VariableDescription.The import correctly points to the parser library's
VariableDescription. The public API method signature at line 45 remains unchanged (Optional<VariableDescription> getDescription()), but now references the migrated type.src/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/BslDocSemanticTokensSupplier.java (2)
102-113: LGTM! Updated range accessors.Correctly uses
range.isEmpty(),range.startLine(), andrange.startCharacter()from theSimpleRangeAPI.
118-127: LGTM! Clean element-based semantic token generation.The switch expression elegantly maps description element types to semantic token types:
TYPE_NAME→SemanticTokenTypes.TypePARAMETER_NAME→SemanticTokenTypes.Parameter- Documentation keywords →
SemanticTokenTypes.Macro- Unknown types return
""which is safely handled (skipped byaddEntrywhen type index is -1)This data-driven approach is cleaner than the previous AST/tokenizer-based logic.
|



Описание
Связанные задачи
Closes
Чеклист
Общие
gradlew precommit)Для диагностик
Дополнительно
Summary by CodeRabbit
Refactor
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.