Skip to content

feat(description): добавить VariableDescription.getTypes() с List<TypeDescription>#392

Merged
nixel2007 merged 1 commit into
developfrom
claude/variable-description-types-accessor
Jun 19, 2026
Merged

feat(description): добавить VariableDescription.getTypes() с List<TypeDescription>#392
nixel2007 merged 1 commit into
developfrom
claude/variable-description-types-accessor

Conversation

@nixel2007

Copy link
Copy Markdown
Member

Зачем

Follow-up к #391. После #391 тип переменной отдавался только «сырыми» элементами getElements() (range + TYPE_NAME), и потребителю (например, bsl-language-server) приходилось вырезать имя типа из текста комментария по абсолютному диапазону — неудобно и хрупко, в отличие от MethodDescription.getReturnedValue() : List<TypeDescription>.

Что сделано

  • VariableDescription: добавлен аксессор getTypes() : List<TypeDescription> — полный паритет с MethodDescription.getReturnedValue(). Каждый элемент несёт name(), variant(), fields() и element() с абсолютной областью. Если тип в описании не указан (свободный текст) — список пуст.
  • VariableDescriptionReader: типы строятся из тех же грамматических правил (type/returnsValue) через существующие фабрики SimpleTypeDescription / CollectionTypeDescription (гиперссылки См. по-прежнему пропускаются — это ссылка, она в links).
  • Совместимость: getElements() сохраняет прежнее поведение и продолжает включать имена вложенных типов значений коллекции (// Массив из Строка → два TYPE_NAME-элемента: Массив и Строка). Для этого добавлен явный рекурсивный сбор элементов, т.к. CollectionTypeDescription.allElements() сам value-типы не отдаёт.

Пример: для // Массив из Строка - описание теперь getTypes() = один тип Массив<Строка> (collectionName()="Массив", valueTypes()=[Строка]), а getElements() = два TYPE_NAME-элемента (как раньше).

Тесты

Добавлены проверки getTypes() во все типизированные кейсы (простой, квалифицированный, коллекция, список, ссылка, свободный текст, висячее описание). getDescription()/purposeDescription/links/deprecated не изменены. Полный прогон ./gradlew test зелёный.

Follow-up

После релиза этой версии — поднять зависимость bsl-parser в bsl-language-server (build.gradle.kts), тогда подсветка и обработка типа переменной (в т.ч. в висячих комментариях, #4165) сможет читать тип напрямую через getTypes().

🤖 Generated with Claude Code


Generated by Claude Code

…eDescription>

Описание переменной теперь отдаёт типы не только «сырыми» элементами
getElements() (range + TYPE_NAME), но и удобным аксессором getTypes() —
по аналогии с MethodDescription.getReturnedValue(). Каждый элемент
несёт name(), variant(), fields() и element() с абсолютной областью,
поэтому потребителю (например, bsl-language-server) больше не нужно
вырезать имя типа из текста комментария по диапазону.

Типы строятся из тех же грамматических правил (type/returnsValue) через
существующие SimpleTypeDescription/CollectionTypeDescription. getElements()
сохраняет прежнее поведение и продолжает включать имена вложенных типов
значений коллекции (Массив из Строка → два TYPE_NAME-элемента).

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 17 minutes and 55 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: 31e9ae2f-a9d8-4e62-bfe8-3e7ea3b6ffd2

📥 Commits

Reviewing files that changed from the base of the PR and between 0901ab1 and 863532c.

📒 Files selected for processing (3)
  • src/main/java/com/github/_1c_syntax/bsl/parser/description/VariableDescription.java
  • src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/VariableDescriptionReader.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-types-accessor

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.

@nixel2007
nixel2007 merged commit 045f851 into develop Jun 19, 2026
16 checks passed
@nixel2007
nixel2007 deleted the claude/variable-description-types-accessor branch June 19, 2026 09:37
@sonarqubecloud

Copy link
Copy Markdown

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