fix(inlayhints): не показывать тип переменной, если имя уже несёт имя типа#4267
Conversation
… типа Хинт выведенного типа переменной подавляется, когда имя переменной уже содержит имя типа (например «Массив» с типом «Массив»): подсказка лишь дублирует видимое в имени и шумит. По аналогии с подавлением подсказок имён параметров с совпадающим именем аргумента. Closes #4247 Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01SSt7bML8BDg8DGV9BRDdjo
|
Warning Review limit reached
Next review available in: 31 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 (6)
📝 WalkthroughWalkthrough
ChangesVariable type hint suppression
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
|
/buildJar Generated by Claude Code |
|
✅ Собраны JAR-файлы для этого PR по команде Артефакт: 8304260982 Файлы внутри:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplierTest.java (1)
122-124: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a test case for case-insensitive containment.
The test variables (
МассивandМассивИсточник) exactly match the casing of the inferred typeМассив. Consider adding a test case with different casing to explicitly guarantee the case-insensitive behavior mentioned in the PR summary.💡 Proposed test case addition
Массив = Источник; МассивИсточник = Источник; + массивОстатков = Источник;🤖 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/inlayhints/VariableTypeInlayHintSupplierTest.java` around lines 122 - 124, Add a test case in VariableTypeInlayHintSupplierTest covering containment when the variable and inferred type use different casing. Keep the existing exact-case assertions and verify that the case-insensitive match still infers the expected Массив type.
🤖 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/inlayhints/VariableTypeInlayHintSupplierTest.java`:
- Around line 122-124: Add a test case in VariableTypeInlayHintSupplierTest
covering containment when the variable and inferred type use different casing.
Keep the existing exact-case assertions and verify that the case-insensitive
match still infers the expected Массив type.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3fa6664e-dcb6-42c8-b07c-0c3ba4c912a7
📒 Files selected for processing (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplier.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplierTest.java
… регистронезависимость Sonar (java:S1142) ругался на 6 return в toInlayHint — проверка диапазона слита с проверкой тривиальности выражения, поведение не меняется. Также в тест добавлен кейс с именем переменной в другом регистре («массивОстатков»), подтверждающий регистронезависимость подавления. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01SSt7bML8BDg8DGV9BRDdjo
…еменной Подавление подсказки выведенного типа, когда имя переменной уже содержит имя типа, теперь управляется вложенным флагом конфига inlayHint.parameters.variableType.showTypeWithTheSameName (по умолчанию false — подавлять). Полная аналогия с showParametersWithTheSameName у methodCall: пользователь может вернуть показ таких подсказок. Обновлены JSON-схема и документация настроек (ru/en), добавлен тест на включённый флаг. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01SSt7bML8BDg8DGV9BRDdjo
|



Описание
Инлайн-хинт выведенного типа переменной больше не выводится, когда имя переменной уже содержит имя типа. Раньше для присваивания вида
Массив = ...с выведенным типомМассивхинт: Массивдублировал то, что и так видно в имени переменной, и лишь шумел.Проверка добавлена в
VariableTypeInlayHintSupplier: если имя переменной содержит имя типа (регистронезависимо), хинт не строится. Механизм намеренно повторяет уже принятое в проекте подавление подсказок имён параметров с совпадающим именем аргумента (SourceDefinedMethodCallInlayHintCollectorиспользует тот жеStrings.CI.contains) — как и просил автор задачи.Так
Массив = ...иМассивТоваров = ...(типМассив) подсказку больше не получают, аКопия = Источник(типМассив) — по-прежнему получает.Связанные задачи
Closes #4247
Чеклист
Общие
gradlew precommit)Дополнительно
Затронуты:
src/main/java/.../inlayhints/VariableTypeInlayHintSupplier.java— логика подавления + javadoc;src/test/java/.../inlayhints/VariableTypeInlayHintSupplierTest.java— новый тестtestNoHintWhenVariableNameContainsTypeName.🤖 Generated with Claude Code
Generated by Claude Code
Summary by CodeRabbit