fix(completion): сохранять типы полей элемента Соответствия в автокомплите#4208
Conversation
|
Warning Review limit reached
Next review available in: 51 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. 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, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughCompletionProvider now preserves full local-field type information when building dot completions. A new test class verifies that map element completions expose typed details and documentation for ChangesMap element completion typing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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
🤖 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/providers/CompletionProvider.java`:
- Around line 447-472: The per-ref interleaving in CompletionProvider’s type
collection can still let an untyped platform member win over a documented field
when typeSet has multiple refs. Update the logic in CompletionProvider to do a
two-pass merge: first iterate all refs and add local/documented fields from
getLocalFields() to members, then iterate all refs again to add platform members
from typeService.getMembers(). Keep using the existing symbols members,
localFieldNames, owners, and MemberDescriptor.property so documented fields
always take precedence regardless of ref order.
🪄 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
Run ID: 5fa60033-92bb-4937-b2a4-275082136323
⛔ Files ignored due to path filters (1)
src/test/resources/types/MapElementCompletion.bslis excluded by!src/test/resources/**
📒 Files selected for processing (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/CompletionProvider.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/providers/MapElementCompletionTest.java
|
/buildJar |
|
✅ Собраны JAR-файлы для этого PR по команде Артефакт: 7890250715 Файлы внутри:
|
Test Results 3 582 files 3 582 suites 1h 44m 27s ⏱️ Results for commit 36fbcc9. ♻️ This comment has been updated with latest results. |
…плите При автодополнении по элементу `Соответствие из КлючИЗначение` (переменная цикла `Для Каждого Элемент Из ...`) у предложений `Ключ`/`Значение` пропадали типы из JsDoc (`Строка`/`Число`) и описания. Причина: в `dotCompletion` сначала добавлялись члены типа из реестра (платформенные `КлючИЗначение.Ключ`/`.Значение` — без типа), а затем декларированные поля через `putIfAbsent`, который оставлял уже добавленный бестиповый платформенный член. Комментарий в коде декларировал обратный приоритет, но порядок обработки ему противоречил. Теперь поля «открытого» объекта данных обрабатываются ПЕРЕД членами типа, поэтому задокументированное поле приоритетнее одноимённого дефолтного члена. Поле кладётся полным `TypeSet` (как в `DereferenceMemberMatcher`), а не только головным ref. Closes #4206 Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_017JsLkTx1s33wvzgFZn2FgV
…union По замечанию CodeRabbit: при чередовании поле/член внутри одного цикла по ref'ам у union-ресивера бестиповый платформенный член одного ref мог быть добавлен раньше одноимённого задокументированного поля другого ref и затенить его через putIfAbsent. Теперь сначала собираются все декларированные поля по всем ref'ам, затем все члены типов — задокументированное поле приоритетнее независимо от порядка обхода. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_017JsLkTx1s33wvzgFZn2FgV
19c20f2 to
8378dbb
Compare
По замечанию SonarCloud: сложность dotCompletion выросла до 12 (> 10, java:S1541), а два прохода по typeSet.refs() ловились как S3047 («объедините циклы»). Оба прохода вынесены в методы collectDeclaredFields и collectTypeMembers — цикломатическая сложность dotCompletion снижена, а разнесение по методам сохраняет двухпроходный порядок (поле приоритетнее одноимённого члена), который объединять в один цикл нельзя. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_017JsLkTx1s33wvzgFZn2FgV
|



При автодополнении по элементу
Соответствие из КлючИЗначение(переменнаяцикла
Для Каждого Элемент Из ...) у предложенийКлюч/Значениепропадалитипы из JsDoc (
Строка/Число) и описания.Причина: в
dotCompletionсначала добавлялись члены типа из реестра(платформенные
КлючИЗначение.Ключ/.Значение— без типа), а затемдекларированные поля через
putIfAbsent, который оставлял уже добавленныйбестиповый платформенный член. Комментарий в коде декларировал обратный
приоритет, но порядок обработки ему противоречил.
Теперь поля «открытого» объекта данных обрабатываются ПЕРЕД членами типа,
поэтому задокументированное поле приоритетнее одноимённого дефолтного члена.
Поле кладётся полным
TypeSet(как вDereferenceMemberMatcher), а не толькоголовным ref.
Closes #4206
Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_017JsLkTx1s33wvzgFZn2FgV
Summary by CodeRabbit