Skip to content

Extract variable type from description start#391

Merged
nixel2007 merged 2 commits into
developfrom
claude/variable-description-type-element
Jun 19, 2026
Merged

Extract variable type from description start#391
nixel2007 merged 2 commits into
developfrom
claude/variable-description-type-element

Conversation

@nixel2007

Copy link
Copy Markdown
Member

Summary

Add support for extracting variable type information from the beginning of variable descriptions using the "type - description" notation (e.g., "// Строка - описание"). This allows the parser to identify and track type declarations in variable documentation comments.

Key Changes

  • New grammar rule (variableDescription and variableType) in BSLDescriptionParser.g4 to parse variable descriptions with optional type information at the start
  • New tokenizer class VariableDescriptionTokenizer to parse descriptions using the variable-specific grammar rule
  • Type extraction logic in VariableDescriptionReader to:
    • Parse the first significant line of variable descriptions for type information
    • Extract type elements (simple types, qualified types, collection types, and list types)
    • Add extracted types as DescriptionElement.Type.TYPE_NAME elements with absolute coordinates
  • Comprehensive test coverage with 5 new test cases covering:
    • Simple type extraction ("Строка")
    • Qualified type extraction ("СправочникСсылка.Контрагенты")
    • Type without separator
    • Regression test for free text without type
    • Trailing comment type extraction with proper absolute positioning

Implementation Details

  • Type extraction uses a separate tokenizer to avoid interfering with the existing methodDescription parsing
  • Coordinates for extracted type elements are absolute (matching DEPRECATE_KEYWORD behavior), accounting for line and character shifts
  • Supports complex type structures: simple types, qualified types (with dots), collection types, and list types
  • Hyperlink types are intentionally skipped as they are already tracked in the links collection

https://claude.ai/code/session_01TX5hqgS58htjayb4thDxXA

Описание переменной теперь отдаёт тип, указанный в начале первой
значимой строки (нотация «тип в начале»), отдельным элементом
DescriptionElement типа TYPE_NAME — по аналогии с типами параметров
и возвращаемого значения в описаниях методов.

Тип извлекается отдельным разбором правила variableDescription,
переиспользующего грамматическое правило returnsValue/type, поэтому
квалифицированные и составные типы (коллекции, списки) разбираются
целиком, а свободный текст без типа не порождает ложных TYPE_NAME.
Координаты элемента абсолютные (через lineShift/firstLineCharShift),
что корректно работает и для висячих (trailing) описаний.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TX5hqgS58htjayb4thDxXA
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@nixel2007, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 7 minutes and 15 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bb74eb51-a6df-42a6-8c24-222e74b9c886

📥 Commits

Reviewing files that changed from the base of the PR and between 0ee66e9 and 20a87e9.

📒 Files selected for processing (4)
  • src/main/antlr/BSLDescriptionParser.g4
  • src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/VariableDescriptionReader.java
  • src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/VariableDescriptionTokenizer.java
  • src/test/java/com/github/_1c_syntax/bsl/parser/description/BSLDescriptionReaderTest.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/variable-description-type-element

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.

… переменных

Добавлены тесты на извлечение TYPE_NAME для типа-коллекции
(Массив из ...), перечисления типов через запятую и на пропуск
типа-гиперссылки (См.). Закрывает ветки разбора, не покрытые ранее
(Quality Gate: покрытие нового кода).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TX5hqgS58htjayb4thDxXA
@sonarqubecloud

Copy link
Copy Markdown

@nixel2007
nixel2007 merged commit 1f1d8d8 into develop Jun 19, 2026
18 checks passed
@nixel2007
nixel2007 deleted the claude/variable-description-type-element branch June 19, 2026 08:40
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