feat(types): ссылка «См.» разбирает путь в нотации конфигуратора - #4374
Conversation
Ссылка вида «Справочник.Товары.ЕдиницыИзмерения» разбиралась как цепочка членов: первый сегмент искался среди глобальных свойств, а там «Справочники», и резолв обрывался сразу. Теперь такой путь собирается в имя типа — реестр складывает его из того же вида объекта метаданных, что стоит в начале ссылки. Разбираются табличная часть объекта, её реквизит и реквизит самого объекта. Заодно объявленному типу-коллекции проставляется тип её элемента: «Для Каждого» по параметру, чей тип объявлен комментарием, иначе не знает, что перебирает. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe change adds metadata-path resolution for qualified ChangesMetadata type inference
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ExpressionTypeInferencer
participant SymbolTypeIndex
participant TypeRegistry
ExpressionTypeInferencer->>SymbolTypeIndex: resolveSeeReference(metadata path)
SymbolTypeIndex->>TypeRegistry: resolve metadata member type
TypeRegistry-->>SymbolTypeIndex: return qualified type
SymbolTypeIndex-->>ExpressionTypeInferencer: return inferred type
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java (1)
82-93: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for an object property reference.
Add a test for
Справочник.<Объект>.<Реквизит>. The current tests do not execute the object-property branch inSymbolTypeIndex.resolveMetadataPath, so a regression in that supported path will not fail this test class.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java` around lines 82 - 93, Add a test in MetadataSeeRefInferenceTest covering a Справочник object property reference using the existing document context and type-resolution helpers. Assert the resolved type matches the referenced property, exercising the object-property branch in SymbolTypeIndex.resolveMetadataPath.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/types/index/SymbolTypeIndex.java`:
- Around line 404-410: Update the metadata-path handling around the section and
row resolution so paths with extra segments are rejected. Preserve trailing
empty segments when splitting the path, require exactly four segments before
resolving a row property, and only call memberTypes with parts[3] when that
exact-length condition is satisfied; otherwise return TypeSet.EMPTY.
---
Nitpick comments:
In
`@src/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java`:
- Around line 82-93: Add a test in MetadataSeeRefInferenceTest covering a
Справочник object property reference using the existing document context and
type-resolution helpers. Assert the resolved type matches the referenced
property, exercising the object-property branch in
SymbolTypeIndex.resolveMetadataPath.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e76c84a4-e8ea-4540-a1bb-433788bfc899
⛔ Files ignored due to path filters (1)
src/test/resources/types/MetadataSeeRef.bslis excluded by!src/test/resources/**
📒 Files selected for processing (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/index/SymbolTypeIndex.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/types/inferencer/ExpressionTypeInferencer.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java
Путь длиннее «вид.объект.часть.реквизит» больше не разрешается по первым четырём частям: хвост молча отбрасывался, и «…ТабличнаяЧасть1.Реквизит1.Лишнее» выдавал тип реквизита. Пустые части при разборе сохраняются. Номера частей ссылки вынесены в константы, снята мёртвая проверка точки входа графа потока управления — она не может быть пустой.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java (1)
118-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAssert the
TypeSetcontract directly.Line 118 projects
TypeSetthroughnames(types)before checking emptiness. UseTypeSet.isEmpty()to keep this assertion focused on the absence of inferred types.Proposed assertion
- assertThat(names(types)).isEmpty(); + assertThat(types.isEmpty()).isTrue();🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java` at line 118, Update the assertion in MetadataSeeRefInferenceTest to call TypeSet.isEmpty() directly on types instead of projecting through names(types), while preserving the expectation that no inferred types are present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@src/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java`:
- Line 118: Update the assertion in MetadataSeeRefInferenceTest to call
TypeSet.isEmpty() directly on types instead of projecting through names(types),
while preserving the expectation that no inferred types are present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a8070a51-795d-4620-b5f0-4b20807e2451
⛔ Files ignored due to path filters (1)
src/test/resources/types/MetadataSeeRef.bslis excluded by!src/test/resources/**
📒 Files selected for processing (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/index/SymbolTypeIndex.javasrc/main/java/com/github/_1c_syntax/bsl/languageserver/types/inferencer/ExpressionTypeInferencer.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/types/MetadataSeeRefInferenceTest.java
💤 Files with no reviewable changes (1)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/types/inferencer/ExpressionTypeInferencer.java
🚧 Files skipped from review as they are similar to previous changes (1)
- src/main/java/com/github/_1c_syntax/bsl/languageserver/types/index/SymbolTypeIndex.java
Части, оставшиеся после объекта метаданных, разбираются по одной: каждая следующая берётся членом типа, полученного на предыдущей. Ограничение длины ссылки больше не нужно — путь либо доходит до конца, либо обрывается на неизвестном или неоднозначном члене.
|



Первый шаг по семейству ссылок
См.из полигона #4345 — пункты 3.22, 3.24 и 3.25 рекомендации.Что было
Тип не выводился вовсе. Ссылка разбиралась как цепочка членов: первый сегмент
Справочникискался среди глобальных свойств, а тамСправочники— резолв обрывался на первом же шаге.Что стало
Путь в нотации конфигуратора собирается в имя типа: реестр складывает имена из того же вида объекта метаданных, что стоит в начале ссылки, поэтому
Справочник.Справочник1.ТабличнаяЧасть1превращается вСправочникТабличнаяЧасть.Справочник1.ТабличнаяЧасть1, который уже зарегистрирован вместе со строкой и её колонками.Разбираются:
<Вид>.<Объект>.<ТабличнаяЧасть>— сама табличная часть;<Вид>.<Объект>.<ТабличнаяЧасть>.<Реквизит>— тип реквизита табличной части;<Вид>.<Объект>.<Реквизит>— тип реквизита объекта.Заодно объявленному типу-коллекции проставляется тип её элемента:
Для Каждогопо параметру, чей тип объявлен комментарием, иначе не знает, что перебирает.Проверка
Новый
MetadataSeeRefInferenceTest: тип табличной части по ссылке, колонка её строки при обходеДля Каждого, тип реквизита табличной части. Прогнаныtypes,hover,completion.🤖 Generated with Claude Code
https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y
Summary by CodeRabbit
Неопределено.