Skip to content

Conversation

@nixel2007
Copy link
Member

@nixel2007 nixel2007 commented Jan 4, 2026

Описание

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

Closes

Чеклист

Общие

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

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

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

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

Summary by CodeRabbit

  • New Features

    • Enhanced hover tooltips now display variable classification (global, module-level, local, parameter, dynamic).
  • Localization

    • Added English and Russian language support for variable type descriptions in hover information.
  • Tests

    • Updated test suite to validate variable type information in hover content generation.

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

Copilot AI review requested due to automatic review settings January 4, 2026 08:27
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 4, 2026

📝 Walkthrough

Walkthrough

The changes add localized variable type information to variable hover content. A new helper method in VariableSymbolMarkupContentBuilder maps variable kinds to resource strings, with corresponding English and Russian localization files. Tests are updated to verify the new variable info section appears in generated hover markup.

Changes

Cohort / File(s) Summary
Core Functionality
src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java
Adds Resources dependency field, introduces getVariableInfo(VariableSymbol) helper that maps variable kinds (GLOBAL, MODULE, LOCAL, PARAMETER, DYNAMIC variants) to localized resource strings via new getResourceString(String key) helper; integrates variable info section into markup content generation after signature and before location.
Localization
src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_en.properties, src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_ru.properties
New English and Russian resource files defining localized labels for variable types: globalVariable, moduleVariable, localVariable, methodParameter, dynamicVariableOfModule, dynamicVariableOfMethod with format placeholders for method names.
Tests
src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilderTest.java
Updates test assertions to account for new variable info content block; expected block counts increase by one per test method; file-link block indices shift to later positions; assertions for second block now verify exact variable type text (e.g., "Переменная уровня модуля") before file-link validation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~14 minutes

Poem

🐰 Hark! A rabbit hops with glee,
Variable kinds now all to see—
Global, local, parameter fine,
In English text and Russian line!
The hover blooms with info bright, 🌱

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding variable declaration location information to the hover feature, which aligns with the code changes that introduce variable kind information (global, module, local, parameter, dynamic) in VariableSymbolMarkupContentBuilder.
✨ Finishing touches
  • 📝 Generate docstrings

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: 0

🧹 Nitpick comments (2)
src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilderTest.java (1)

57-226: Consider adding test coverage for GLOBAL, PARAMETER, and DYNAMIC variable kinds.

The existing tests cover MODULE and LOCAL variables well. To ensure comprehensive coverage of the new getVariableInfo logic, consider adding tests for:

  • GLOBAL variables
  • METHOD parameters (PARAMETER kind)
  • DYNAMIC variables at both module and method levels
Example test structure
@Test
void testMethodParameterVariable() {
  // Test PARAMETER kind with "Параметр метода %s" format
}

@Test
void testDynamicVariableOfModule() {
  // Test DYNAMIC kind at module scope
}

@Test
void testDynamicVariableOfMethod() {
  // Test DYNAMIC kind at method scope with "Динамическая переменная метода %s" format
}
src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_en.properties (1)

8-8: Optional: Remove trailing blank line for consistency.

The Russian localization file (_ru.properties) doesn't have this trailing blank line. Consider removing it for consistency between the two resource files.

📜 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 9c1f478 and 23af142.

📒 Files selected for processing (4)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_en.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_ru.properties
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilderTest.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/hover/VariableSymbolMarkupContentBuilder.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/hover/VariableSymbolMarkupContentBuilder.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilderTest.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/hover/VariableSymbolMarkupContentBuilderTest.java
🧠 Learnings (5)
📓 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-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/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/hover/VariableSymbolMarkupContentBuilder_ru.properties
📚 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.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.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). (14)
  • GitHub Check: Benchmark
  • GitHub Check: Analyse
  • GitHub Check: CodeQL analysis (java)
  • GitHub Check: Agent
  • GitHub Check: build
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, ubuntu-latest)
🔇 Additional comments (11)
src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_ru.properties (1)

1-7: LGTM! Russian localization properly structured.

The Russian localization keys are well-defined with appropriate format placeholders (%s) for method names. The corresponding English version is also present, satisfying the bilingual resource bundle requirement.

src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java (4)

27-27: LGTM! Resources dependency properly added.

The Resources field is correctly added and will be auto-injected via the existing @RequiredArgsConstructor annotation.

Also applies to: 45-45


60-62: LGTM! Variable info section cleanly integrated.

The new variable information section is appropriately positioned between the signature and location, with proper formatting using the addSectionIfNotEmpty helper.


100-102: LGTM! Clean delegation to Resources utility.

The helper method provides a clean abstraction for resource string retrieval.


88-98: No action needed. The switch expression is safe as written: symbol.getScope() is guaranteed to return a non-null value for LOCAL, PARAMETER, and DYNAMIC variable kinds based on how VariableSymbols are constructed in VariableSymbolComputer. The scope field is always set during builder construction, and getVariableScope() has safeguards to prevent null returns.

src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilderTest.java (5)

71-86: LGTM! Test properly updated for new content structure.

The test correctly accounts for the additional variable info block, with updated assertions for block count and content validation.


102-121: LGTM! Test assertions correctly adjusted.

Block indices properly shifted to accommodate the new variable info section, with accurate regex patterns for file links.


138-159: LGTM! Local variable info correctly validated.

The test properly verifies "Локальная переменная метода ИмяФункции" content for method-scoped variables.


176-196: LGTM! Consistent test updates maintained.

Block structure and assertions properly aligned with the new hover content format.


214-226: LGTM! Object module variable test updated correctly.

The test validates module-level variable info from metadata-based object modules.

src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_en.properties (1)

1-7: LGTM! English localization properly structured.

The English translations are accurate and correctly mirror the Russian resource file structure with appropriate format placeholders for method names.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the hover information for variables by adding details about the variable's kind and scope (e.g., "Module-level variable", "Local variable of method MethodName"). The feature supports internationalization with both Russian and English translations.

Key Changes:

  • Added localized variable kind descriptions to hover tooltips
  • Implemented switch expression to categorize variables by their kind (GLOBAL, MODULE, LOCAL, PARAMETER, DYNAMIC)
  • Updated all existing tests to accommodate the new information block in hover content

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java Implements the getVariableInfo() method to generate localized variable kind descriptions using a switch expression on VariableKind enum
src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_ru.properties Adds Russian translations for all variable kinds (global, module, local, parameter, dynamic)
src/main/resources/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder_en.properties Adds English translations for all variable kinds (global, module, local, parameter, dynamic)
src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilderTest.java Updates test assertions to expect 3-4 blocks instead of 2-3 blocks, adding assertions for the new variable info block between signature and location

methodParameter=Parameter of method %s
dynamicVariableOfModule=Dynamic variable of module
dynamicVariableOfMethod=Dynamic variable of method %s

Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The English properties file has an extra blank line at the end (line 8), while the Russian properties file ends at line 7. For consistency with other resource files in the project, both files should have the same format. Consider removing the extra blank line from the English file or adding it to the Russian file to maintain consistency.

Suggested change

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 4, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
44.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@nixel2007 nixel2007 merged commit e74fae3 into develop Jan 4, 2026
45 of 46 checks passed
@nixel2007 nixel2007 deleted the feature/variable-info-in-hover branch January 4, 2026 08:41
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