Skip to content

fix(inlayhints): не показывать тип переменной, если имя уже несёт имя типа#4267

Merged
nixel2007 merged 3 commits into
developfrom
claude/issue-4247-0meqa7
Jul 15, 2026
Merged

fix(inlayhints): не показывать тип переменной, если имя уже несёт имя типа#4267
nixel2007 merged 3 commits into
developfrom
claude/issue-4247-0meqa7

Conversation

@nixel2007

@nixel2007 nixel2007 commented Jul 14, 2026

Copy link
Copy Markdown
Member

Описание

Инлайн-хинт выведенного типа переменной больше не выводится, когда имя переменной уже содержит имя типа. Раньше для присваивания вида Массив = ... с выведенным типом Массив хинт : Массив дублировал то, что и так видно в имени переменной, и лишь шумел.

Проверка добавлена в VariableTypeInlayHintSupplier: если имя переменной содержит имя типа (регистронезависимо), хинт не строится. Механизм намеренно повторяет уже принятое в проекте подавление подсказок имён параметров с совпадающим именем аргумента (SourceDefinedMethodCallInlayHintCollector использует тот же Strings.CI.contains) — как и просил автор задачи.

Так Массив = ... и МассивТоваров = ... (тип Массив) подсказку больше не получают, а Копия = Источник (тип Массив) — по-прежнему получает.

Связанные задачи

Closes #4247

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду 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

  • Bug Fixes
    • Suppressed redundant variable type inlay hints when the variable name already includes the inferred type (case-insensitive match).
    • Refined inlay-hint generation to avoid producing hints in trivial or non-applicable scenarios.
  • Tests
    • Added a test ensuring no variable type inlay hints are shown when the variable name already contains the inferred type name.

… типа

Хинт выведенного типа переменной подавляется, когда имя переменной уже
содержит имя типа (например «Массив» с типом «Массив»): подсказка лишь
дублирует видимое в имени и шумит. По аналогии с подавлением подсказок
имён параметров с совпадающим именем аргумента.

Closes #4247

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SSt7bML8BDg8DGV9BRDdjo
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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 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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b990960b-11ad-4f44-8749-b47f35c5c409

📥 Commits

Reviewing files that changed from the base of the PR and between 7449413 and e6b22ba.

📒 Files selected for processing (6)
  • docs/en/features/ConfigurationFile.md
  • docs/features/ConfigurationFile.md
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintFlags.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplier.java
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplierTest.java
📝 Walkthrough

Walkthrough

VariableTypeInlayHintSupplier suppresses type inlay hints when a variable name already contains the inferred type name, using a case-insensitive check. Documentation and a regression test cover the behavior.

Changes

Variable type hint suppression

Layer / File(s) Summary
Suppress redundant variable type hints
src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplier.java, src/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplierTest.java
The supplier consolidates early exits, checks variable names against inferred type names before creating hints, documents the behavior, and tests that matching names produce no hints.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly states the main change: suppressing type inlay hints when the variable name already contains the type name.
Linked Issues check ✅ Passed The implementation matches the issue by suppressing variable type inlay hints when the name already includes the inferred type name.
Out of Scope Changes check ✅ Passed The changes stay within the inlay hint logic and its test coverage, with no unrelated edits introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-4247-0meqa7

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.

Copy link
Copy Markdown
Member Author

/buildJar


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

✅ Собраны JAR-файлы для этого PR по команде /buildJar.

Артефакт: 8304260982

Файлы внутри:

  • bsl-language-server-claude-issue-4247-0meqa7-7150527-exec.jar

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplierTest.java (1)

122-124: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add 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

📥 Commits

Reviewing files that changed from the base of the PR and between 316ff75 and 7150527.

📒 Files selected for processing (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/VariableTypeInlayHintSupplierTest.java

claude added 2 commits July 14, 2026 08:10
… регистронезависимость

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
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 3 636 files  ± 0   3 636 suites  ±0   1h 46m 59s ⏱️ + 7m 21s
 3 595 tests + 2   3 577 ✅ + 2   18 💤 ±0  0 ❌ ±0 
21 570 runs  +12  21 458 ✅ +12  112 💤 ±0  0 ❌ ±0 

Results for commit e6b22ba. ± Comparison against base commit 316ff75.

@nixel2007
nixel2007 merged commit 308c22e into develop Jul 15, 2026
36 of 37 checks passed
@nixel2007
nixel2007 deleted the claude/issue-4247-0meqa7 branch July 15, 2026 11:32
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.

[BUG] инлайнхинт на тип.

2 participants