Skip to content

Добавлена линза для отладки тестов#3682

Merged
nixel2007 merged 3 commits into1c-syntax:developfrom
sfaqer:feature/debugTests
Dec 19, 2025
Merged

Добавлена линза для отладки тестов#3682
nixel2007 merged 3 commits into1c-syntax:developfrom
sfaqer:feature/debugTests

Conversation

@sfaqer
Copy link
Member

@sfaqer sfaqer commented Dec 19, 2025

Описание

Добавлена линза для отладки тестов, код линзы упорядочены

Связанные задачи

Closes: #3681

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

1c-syntax/vsc-language-1c-bsl#340

Summary by CodeRabbit

  • New Features

    • Added a "Debug test" CodeLens to debug individual tests from source.
  • Configuration

    • New debugTestArguments option to customize debug command placeholders; clarified runTestArguments placeholders.
  • Documentation

    • Updated DTO Javadoc text.
  • Chores

    • Standardized CodeLens supplier ordering for predictable prioritization.
  • Bug Fixes

    • Deduplicate collected test IDs when assembling run targets.
  • Tests

    • Added tests for debug CodeLens generation and resolution.
  • Localization

    • Added localized titles for the debug CodeLens (en/ru).

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

Adds a DebugTest CodeLens supplier and tests; applies @Order annotations to several code-lens suppliers and sorts enabled suppliers by order; adds debugTestArguments option and schema entry; deduplicates test IDs in TestRunnerAdapter; adds localization resources.

Changes

Cohort / File(s) Summary
New Debug Test supplier
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java, src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
Adds DebugTestCodeLensSupplier (extends AbstractRunTestsCodeLensSupplier) with nested DebugTestCodeLensData; builds debug command using debugTestArguments; includes unit tests for generation and resolve.
Supplier ordering annotations
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
Import org.springframework.core.annotation.Order and apply @Order annotations (RunAllTests=1, RunTest=2, CognitiveComplexity=4, CyclomaticComplexity=5).
Configuration: ordering & options
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java, src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json
Sort enabled suppliers by Spring @Order (defaults to Ordered.LOWEST_PRECEDENCE when missing); add .distinct() when computing test IDs; add debugTestArguments option and schema entry; update runTestArguments schema title to describe two placeholders.
Localization resources
src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_en.properties, src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_ru.properties
Add localized titles for the debug-test CodeLens (English and Russian).

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant CodeLensManager
    participant Config as CodeLensesConfiguration
    participant DebugSupplier as DebugTestCodeLensSupplier
    participant TestRunner as TestRunnerAdapter
    participant Resources

    Client->>CodeLensManager: request code lenses for document
    CodeLensManager->>Config: get enabled suppliers (sorted by `@Order`)
    Config-->>CodeLensManager: ordered supplier list
    CodeLensManager->>DebugSupplier: provideCodeLenses(document)
    DebugSupplier->>TestRunner: computeTestIdsByTestRunner(document)
    TestRunner-->>DebugSupplier: list of test IDs (distinct)
    DebugSupplier->>Resources: load localized title
    DebugSupplier->>DebugSupplier: assemble debug command using debugTestArguments
    DebugSupplier-->>CodeLensManager: CodeLenses with Commands
    CodeLensManager-->>Client: return CodeLenses
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

  • Inspect DebugTestCodeLensSupplier: command assembly, placeholder substitution, DTO and self-injection cache.
  • Verify CodeLensesConfiguration ordering logic and default precedence handling.
  • Check TestRunnerAdapter .distinct() effect on ordering and consumers.
  • Validate schema.json additions and TestRunnerAdapterOptions field alignment.

Possibly related PRs

Suggested labels

hacktoberfest-accepted

Suggested reviewers

  • theshadowco

Poem

🐰 I sniffed the tests and gave a hop,

Ordered lenses from bottom to top.
Titles in two tongues, commands set to run,
Duplicates gone — one hop, now it's done.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 31.25% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding a code lens for debugging tests, which aligns with the new DebugTestCodeLensSupplier class and related debug test functionality.
Linked Issues check ✅ Passed The PR implements debug test code lens functionality addressing issue #3681, including the new DebugTestCodeLensSupplier class, debug test arguments configuration, test ordering, and comprehensive test coverage.
Out of Scope Changes check ✅ Passed All changes are directly related to the debug test lens feature: new DebugTestCodeLensSupplier class, code lens ordering via @order annotations for existing suppliers, debug arguments configuration, and supporting test infrastructure.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89e0bed and 6c9b685.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.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: Benchmark
  • GitHub Check: build
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: Analyse

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java (2)

67-92: Consider strengthening test assertions.

The tests testDryRun and testRunWithMockedTestIds only verify that the result is not null. Consider asserting on the actual size or content of the code lenses to ensure the supplier behavior is correctly validated.

Additionally, consider adding a test case for when debugTestArguments is empty (lines 90-92 in the supplier), which should return an empty list.

🔎 Suggested improvement for testRunWithMockedTestIds
   @Test
   void testRunWithMockedTestIds() {
     // given
     initializeServer("Visual Studio Code");

     when(testRunnerAdapter.getTestIds(documentContext))
       .thenReturn(List.of("testName"));

     // when
     var codeLenses = supplier.getCodeLenses(documentContext);

     // then
-    assertThat(codeLenses).isNotNull();
+    assertThat(codeLenses).isNotNull().hasSize(1);
   }

94-109: Verify resolved command content.

The test verifies the command is not null but doesn't validate the command ID, title, or arguments. Consider adding assertions to ensure the resolved command has the expected COMMAND_ID and properly formatted arguments.

🔎 Suggested improvement
   @Test
   void testResolve() {
     // given
     CodeLens codeLens = new CodeLens();
     DebugTestCodeLensSupplier.DebugTestCodeLensData codeLensData = new DebugTestCodeLensSupplier.DebugTestCodeLensData(
       documentContext.getUri(),
       supplier.getId(),
       "testName"
     );

     // when
     var resolvedCodeLens = supplier.resolve(documentContext, codeLens, codeLensData);

     // then
-    assertThat(resolvedCodeLens.getCommand()).isNotNull();
+    assertThat(resolvedCodeLens.getCommand()).isNotNull();
+    assertThat(resolvedCodeLens.getCommand().getCommand()).isEqualTo("language-1c-bsl.languageServer.debugTest");
   }
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java (1)

34-34: Unused @Slf4j annotation.

The @Slf4j annotation generates a LOGGER field, but it doesn't appear to be used in this class. Consider removing it to keep the code clean, or add logging if needed for debugging purposes.

🔎 Proposed fix
 import lombok.Getter;
 import lombok.ToString;
 import lombok.Value;
-import lombok.extern.slf4j.Slf4j;
 import org.eclipse.lsp4j.CodeLens;

And remove from class annotation:

 @Component
-@Slf4j
 @Order(3)
 public class DebugTestCodeLensSupplier
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce91ab5 and a3f6daf.

⛔ Files ignored due to path filters (1)
  • src/test/resources/codelenses/DebugTestCodeLensSupplier.os is excluded by !src/test/resources/**
📒 Files selected for processing (12)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_en.properties (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_ru.properties (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
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/codelenses/testrunner/TestRunnerAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.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/codelenses/testrunner/TestRunnerAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.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/codelenses/DebugTestCodeLensSupplierTest.java
🧠 Learnings (11)
📚 Learning: 2025-12-18T18:49:48.694Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.694Z
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/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_ru.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json
📚 Learning: 2025-12-18T18:49:48.694Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.694Z
Learning: Applies to src/main/resources/**/diagnostics/**/*.properties : Resource bundles must have both Russian and English versions for diagnostics

Applied to files:

  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_ru.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_en.properties
📚 Learning: 2025-01-19T21:47:05.209Z
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:47:05.209Z
Learning: В классе AbstractRunTestsCodeLensSupplier проверка поддержки клиента должна выполняться до вызова getTestIds, чтобы предотвратить выполнение лишних операций и обеспечить корректное поведение при неподдерживаемом клиенте.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.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/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.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/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.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/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
📚 Learning: 2025-01-19T21:45:52.703Z
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:45:52.703Z
Learning: В классах-наследниках AbstractRunTestsCodeLensSupplier метод getCodeLenses должен проверять isApplicable перед выполнением своей логики, чтобы учитывать поддержку клиента и другие условия применимости линз.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.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/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
📚 Learning: 2025-01-20T19:30:29.060Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplierTest.java:98-102
Timestamp: 2025-01-20T19:30:29.060Z
Learning: In BSL Language Server, CodeLensProvider handles the isApplicable check before calling getCodeLenses on CodeLensSupplier implementations, so there's no need to add isApplicable check inside getCodeLenses method.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
📚 Learning: 2025-12-18T18:49:48.694Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.694Z
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/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
📚 Learning: 2025-12-18T18:49:48.694Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-12-18T18:49:48.694Z
Learning: Applies to src/test/java/**/*Test.java : Maintain or improve test coverage and use appropriate test frameworks (JUnit, AssertJ, Mockito)

Applied to files:

  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
🧬 Code graph analysis (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java (2)
  • Value (146-165)
  • Component (53-166)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java (1)
  • Component (46-135)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java (1)
  • Component (58-162)
src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java (1)
  • LanguageServerInitializeRequestReceivedEvent (36-56)
src/test/java/com/github/_1c_syntax/bsl/languageserver/util/TestUtils.java (1)
  • TestUtils (37-80)
⏰ 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: Benchmark
  • GitHub Check: build
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
🔇 Additional comments (11)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java (1)

147-147: LGTM! Good defensive practice.

Adding distinct() ensures test IDs are unique before collection, preventing duplicate entries in the returned list.

src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_en.properties (1)

1-1: LGTM! English localization provided.

The resource bundle entry is correctly formatted. Both English and Russian versions are present as required.

src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_ru.properties (1)

1-1: LGTM! Russian localization provided.

The resource bundle entry is correctly formatted with proper Russian translation.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java (1)

35-35: LGTM! Spring ordering annotation added.

The @Order(1) annotation establishes this supplier as the highest priority in the code lens execution sequence.

Also applies to: 48-48

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1)

28-28: LGTM! Spring ordering annotation added.

The @Order(5) annotation positions this complexity supplier appropriately in the execution sequence.

Also applies to: 37-37

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java (1)

32-33: LGTM! Sorting logic correctly implements Spring ordering.

The sorting implementation properly retrieves Spring @Order annotations via OrderUtils.getOrder() and defaults to Ordered.LOWEST_PRECEDENCE for suppliers without explicit ordering, ensuring predictable code lens execution sequence.

Also applies to: 36-36, 39-39, 84-85

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java (1)

39-39: LGTM! Spring ordering annotation added.

The @Order(2) annotation appropriately positions this supplier after the "run all tests" lens.

Also applies to: 55-55

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1)

28-37: LGTM!

The addition of @Order(4) aligns with the PR-wide pattern of organizing CodeLens suppliers by priority. The ordering is logical: test-related lenses (1-3) followed by complexity lenses (4-5).

src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json (1)

752-760: LGTM!

The new debugTestArguments configuration field follows the established pattern of sibling fields like runTestArguments. The empty default ensures the debug code lens only appears when explicitly configured, which is appropriate behavior.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java (2)

50-76: LGTM!

The class structure, dependencies, and self-injection pattern are consistent with existing suppliers like RunTestCodeLensSupplier and follow the established patterns from the learnings. The @Order(3) correctly positions this supplier between RunTestCodeLensSupplier (@order(2)) and complexity suppliers (@order(4-5)).


81-102: LGTM!

The getCodeLenses implementation correctly:

  • Filters out BSL files (consistent with RunTestCodeLensSupplier)
  • Guards against empty debugTestArguments configuration
  • Retrieves test IDs and maps them to code lenses

Based on learnings, the isApplicable check is handled by CodeLensProvider before calling this method, so no additional check is needed here.

@sfaqer sfaqer force-pushed the feature/debugTests branch from a3f6daf to 6693a49 Compare December 19, 2025 06:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3f6daf and 6693a49.

⛔ Files ignored due to path filters (1)
  • src/test/resources/codelenses/DebugTestCodeLensSupplier.os is excluded by !src/test/resources/**
📒 Files selected for processing (12)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_en.properties (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_ru.properties (1 hunks)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_ru.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier_en.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/infrastructure/CodeLensesConfiguration.java
🧰 Additional context used
📓 Path-based instructions (3)
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/codelenses/DebugTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.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/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.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/codelenses/DebugTestCodeLensSupplierTest.java
🧠 Learnings (9)
📚 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/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java
📚 Learning: 2025-01-19T21:45:52.703Z
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:45:52.703Z
Learning: В классах-наследниках AbstractRunTestsCodeLensSupplier метод getCodeLenses должен проверять isApplicable перед выполнением своей логики, чтобы учитывать поддержку клиента и другие условия применимости линз.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.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/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
📚 Learning: 2025-01-20T19:30:29.060Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplierTest.java:98-102
Timestamp: 2025-01-20T19:30:29.060Z
Learning: In BSL Language Server, CodeLensProvider handles the isApplicable check before calling getCodeLenses on CodeLensSupplier implementations, so there's no need to add isApplicable check inside getCodeLenses method.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
📚 Learning: 2025-01-19T21:47:05.209Z
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:47:05.209Z
Learning: В классе AbstractRunTestsCodeLensSupplier проверка поддержки клиента должна выполняться до вызова getTestIds, чтобы предотвратить выполнение лишних операций и обеспечить корректное поведение при неподдерживаемом клиенте.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.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/**/*Test.java : Maintain or improve test coverage and use appropriate test frameworks (JUnit, AssertJ, Mockito)

Applied to files:

  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.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/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.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/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.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/codelenses/CognitiveComplexityCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
🧬 Code graph analysis (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java (2)
  • Value (146-165)
  • Component (53-166)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java (1)
  • Component (58-162)
src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java (1)
  • LanguageServerInitializeRequestReceivedEvent (36-56)
src/test/java/com/github/_1c_syntax/bsl/languageserver/util/TestUtils.java (1)
  • TestUtils (37-80)
⏰ 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: Benchmark
  • GitHub Check: build
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
🔇 Additional comments (10)
src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1)

28-28: LGTM! Correct implementation of code lens ordering.

The import and @Order(4) annotation are correctly applied, aligning this supplier with the PR's objective to establish a consistent ordering for code lens suppliers.

Also applies to: 37-37

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1)

28-37: LGTM! Order annotation correctly applied.

The @Order(5) annotation is properly added to control the ordering of code lens suppliers, consistent with the pattern established in other suppliers (test suppliers at 1-2, complexity suppliers at 4-5).

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java (1)

35-35: LGTM! Ordering annotation added appropriately.

The @Order(1) annotation correctly prioritizes this supplier to appear first among test-related code lenses, which makes sense for the "run all tests" functionality.

Also applies to: 48-48

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/testrunner/TestRunnerAdapter.java (1)

143-148: Good defensive addition, but consider investigating the root cause.

Adding .distinct() prevents duplicate test IDs from being collected, which is a safe improvement. However, this might indicate that the external test runner or the regex pattern in getTestsResultPattern is producing duplicates. Consider investigating whether duplicates are expected behavior or if the underlying issue should be addressed.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java (2)

39-39: LGTM! Ordering annotation added appropriately.

The @Order(2) annotation correctly positions this supplier after RunAllTestsCodeLensSupplier (@order(1)) and before DebugTestCodeLensSupplier (@order(3)), creating a logical sequence for test-related code lenses.

Also applies to: 55-55


144-144: Good fix for the JavaDoc.

The JavaDoc correction changes the description from complexity-related to test-specific, accurately reflecting the purpose of this DTO.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplier.java (4)

50-76: LGTM! Implementation follows established patterns.

The class structure correctly follows the same patterns as RunTestCodeLensSupplier and RunAllTestsCodeLensSupplier, including:

  • Spring component registration with @Order(3) for proper sequencing
  • Self-injection for cache support in the base class
  • Constructor dependency injection

82-102: Good defensive checks in place.

The implementation includes appropriate early-return conditions:

  • Filtering out BSL file types (consistent with RunTestCodeLensSupplier)
  • Checking for empty debugTestArguments configuration

These checks prevent unnecessary processing when debug functionality isn't applicable.


116-134: Verify the resolve implementation handles formatting placeholders correctly.

The String.format call at line 124 expects two placeholders (path and testId) to match the pattern in debugTestArguments. Ensure that the configuration schema and documentation clearly specify this format requirement (e.g., %s %s for path and testId).


147-169: JavaDoc correction applied successfully.

The JavaDoc now correctly describes this DTO as storing debug test data rather than the previous incorrect reference to method complexity data from the past review comment.

Comment on lines +73 to +83
@Test
void testDryRun() {
// given
initializeServer("Visual Studio Code");

// when
var codeLenses = supplier.getCodeLenses(documentContext);

// then
assertThat(codeLenses).isNotNull();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Expand test assertions beyond null checks.

The test only verifies that codeLenses is not null. Consider adding assertions to verify:

  • The actual count of code lenses returned
  • Whether code lenses are empty when expected (e.g., for BSL files or when debugTestArguments is empty)
🔎 Example enhancement
   // then
-  assertThat(codeLenses).isNotNull();
+  assertThat(codeLenses).isNotNull().isEmpty();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Test
void testDryRun() {
// given
initializeServer("Visual Studio Code");
// when
var codeLenses = supplier.getCodeLenses(documentContext);
// then
assertThat(codeLenses).isNotNull();
}
@Test
void testDryRun() {
// given
initializeServer("Visual Studio Code");
// when
var codeLenses = supplier.getCodeLenses(documentContext);
// then
assertThat(codeLenses).isNotNull().isEmpty();
}
🤖 Prompt for AI Agents
In
src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
around lines 73 to 83, the test only asserts that codeLenses is not null; expand
assertions to verify expected behavior by asserting the exact size of codeLenses
(or that it isEmpty() when appropriate), assert specific properties of returned
CodeLens objects (e.g., command/title, range or arguments) for at least one
lens, and add a separate case to assert empty result when debugTestArguments are
empty or when using a non-BSL file; update test setup inputs accordingly to make
these assertions deterministic.

Comment on lines 85 to 110
@Test
void testRunWithMockedTestIds() {
// given
initializeServer("Visual Studio Code");

when(testRunnerAdapter.getTestIds(documentContext))
.thenReturn(List.of("testName"));

var testRunnerAdapterOptions = mock(TestRunnerAdapterOptions.class);

when(testRunnerAdapterOptions.getDebugTestArguments())
.thenReturn("some");

var codeLensOptions = mock(CodeLensOptions.class);
when(codeLensOptions.getTestRunnerAdapterOptions())
.thenReturn(testRunnerAdapterOptions);

when(LanguageServerConfiguration.getCodeLensOptions())
.thenReturn(codeLensOptions);

// when
var codeLenses = supplier.getCodeLenses(documentContext);

// then
assertThat(codeLenses).isNotNull();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Enhance test to verify actual code lens content.

The test mocks dependencies but only checks for non-null results. Consider verifying:

  • The number of code lenses matches the mocked test IDs
  • Each code lens has the correct range and data
  • The code lens data contains the expected test ID
🔎 Example enhancement
   // then
-  assertThat(codeLenses).isNotNull();
+  assertThat(codeLenses)
+    .isNotNull()
+    .hasSize(1)
+    .first()
+    .satisfies(lens -> {
+      assertThat(lens.getRange()).isNotNull();
+      assertThat(lens.getData()).isInstanceOf(DebugTestCodeLensSupplier.DebugTestCodeLensData.class);
+    });

Comment on lines +112 to +127
@Test
void testResolve() {
// given
CodeLens codeLens = new CodeLens();
DebugTestCodeLensSupplier.DebugTestCodeLensData codeLensData = new DebugTestCodeLensSupplier.DebugTestCodeLensData(
documentContext.getUri(),
supplier.getId(),
"testName"
);

// when
var resolvedCodeLens = supplier.resolve(documentContext, codeLens, codeLensData);

// then
assertThat(resolvedCodeLens.getCommand()).isNotNull();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Verify the resolved command details.

The test only checks that the command is not null. Consider verifying:

  • The command title matches the expected localized string
  • The command ID is correct
  • The command arguments contain the properly formatted debug text
🔎 Example enhancement
   // then
-  assertThat(resolvedCodeLens.getCommand()).isNotNull();
+  var command = resolvedCodeLens.getCommand();
+  assertThat(command).isNotNull();
+  assertThat(command.getCommand()).isEqualTo("language-1c-bsl.languageServer.debugTest");
+  assertThat(command.getTitle()).isNotEmpty();
+  assertThat(command.getArguments()).isNotEmpty();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@Test
void testResolve() {
// given
CodeLens codeLens = new CodeLens();
DebugTestCodeLensSupplier.DebugTestCodeLensData codeLensData = new DebugTestCodeLensSupplier.DebugTestCodeLensData(
documentContext.getUri(),
supplier.getId(),
"testName"
);
// when
var resolvedCodeLens = supplier.resolve(documentContext, codeLens, codeLensData);
// then
assertThat(resolvedCodeLens.getCommand()).isNotNull();
}
@Test
void testResolve() {
// given
CodeLens codeLens = new CodeLens();
DebugTestCodeLensSupplier.DebugTestCodeLensData codeLensData = new DebugTestCodeLensSupplier.DebugTestCodeLensData(
documentContext.getUri(),
supplier.getId(),
"testName"
);
// when
var resolvedCodeLens = supplier.resolve(documentContext, codeLens, codeLensData);
// then
var command = resolvedCodeLens.getCommand();
assertThat(command).isNotNull();
assertThat(command.getCommand()).isEqualTo("language-1c-bsl.languageServer.debugTest");
assertThat(command.getTitle()).isNotEmpty();
assertThat(command.getArguments()).isNotEmpty();
}
🤖 Prompt for AI Agents
In
src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/DebugTestCodeLensSupplierTest.java
around lines 112 to 127, the test only asserts the resolved CodeLens command is
non-null; update it to assert the command title equals the expected localized
title, the command id matches the supplier's expected command ID, and the
command arguments contain the correctly formatted debug text (e.g., document
URI, supplier id and test name or the exact string produced by the supplier).
Replace the single notNull assertion with explicit assertions for
command.getTitle(), command.getCommand(), and command.getArguments() (checking
size and content/format), using the same localization helper or constant used by
the supplier so the expected title matches exactly.

@sfaqer sfaqer force-pushed the feature/debugTests branch from 6693a49 to 551564b Compare December 19, 2025 06:40
nixel2007 and others added 2 commits December 19, 2025 08:07
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@nixel2007 nixel2007 enabled auto-merge (squash) December 19, 2025 07:12
@sonarqubecloud
Copy link

@nixel2007 nixel2007 merged commit 32eef8d into 1c-syntax:develop Dec 19, 2025
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Линза для отладки тестов

2 participants