Skip to content

feat(types): ссылка «См.» на параметр метода другого модуля - #4386

Merged
nixel2007 merged 4 commits into
developfrom
feat/types-see-ref-method-parameter
Aug 3, 2026
Merged

feat(types): ссылка «См.» на параметр метода другого модуля#4386
nixel2007 merged 4 commits into
developfrom
feat/types-see-ref-method-parameter

Conversation

@nixel2007

@nixel2007 nixel2007 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Пункт 3.34 рекомендации «Типизация кода», подраздел «Ссылка на тип параметра метода в модели менеджера, объекта, общем модуле»:

// Параметры:
//  Список - См. Справочники.Товары.МетодМодуляМенеджера.Параметр1
Процедура ОбработкаОбъекта(Список)

Что было

Тип не выводился. Разбор ссылки до параметра доходит, но берёт его типы из сигнатуры члена, а у членов модульных типов параметры заводились с пустыми типами: ConfigurationModuleMembersProvider#toMethodMember читал из описания метода тип возвращаемого значения, а параметрам ставил TypeSet.EMPTY.

Что сделано

Типы параметра разрешаются там же и так же, как тип возврата — по головному имени из описания (Массив из СтрокаМассив). Ссылка на параметр после этого работает сама: остальной путь уже был.

Объявленный Произвольный при этом не отбрасывается: тип написан автором описания, поэтому виден и в подсказке автодополнения — у метода общего модуля сигнатура стала (Значение: Произвольный): Массив вместо (Значение): Массив. Ожидание CompletionProviderTest#dotCompletionCommonModuleMethodHasSignatureAndDocumentationLikePlatform обновлено под это.

Проверки

SeeMethodParameterRefInferenceTest: См. ОбщегоНазначения.ОбщийМодуль.ИмяМодуля даёт Строка — тип, объявленный у параметра метода-цели. Тест красный до правки. Общие фикстуры не менялись: взят метод, который в тестовой конфигурации уже есть.

Прогоны *types.*, *providers.*, *hover.* — зелёные.

Что осталось за рамками

Пункт 3.35 (параметр метода модуля объекта, у цели объявлен Массив из Строка) требует ещё и типа элемента коллекции — головного имени для него мало. Пункт 3.36 (наследование типов по сигнатуре чужого метода) опирается на ту же сигнатуру и станет проверяем после этого.

Summary by CodeRabbit

  • Bug Fixes
    • Improved type inference for method parameters using documented parameter types.
    • Added support for resolving collection type descriptions and documented return types.
    • Enhanced completion signatures to display inferred parameter types, including unspecified types where applicable.
    • Improved type recognition when referencing parameters from common-module methods.
  • Tests
    • Added coverage for inferring a string type from a referenced common-module method parameter and validating related completion results.

У членов модульных типов типы параметров не заполнялись: тип возврата читался
из описания, а параметры оставались пустыми — и ссылка «Модуль.Метод.Параметр»
упиралась в пустую сигнатуру. Теперь имена типов параметра разрешаются так же,
как имя типа возврата. «Произвольный» в объявленные не попадает: он ничего
не сообщает о значении.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b11c3627-cd0e-4a78-8674-ac56c33a2697

📥 Commits

Reviewing files that changed from the base of the PR and between 3d3bc52 and 62625cb.

📒 Files selected for processing (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/ConfigurationModuleMembersProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/DescribedTypeResolver.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/ConfigurationModuleMembersProvider.java

📝 Walkthrough

Walkthrough

The change adds a shared resolver for documented method parameter and return types. Common-module descriptors use it, completion expects typed parameters, and an integration test verifies См. reference inference.

Changes

Parameter type inference

Layer / File(s) Summary
Resolve documented method types
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/DescribedTypeResolver.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/ConfigurationModuleMembersProvider.java
DescribedTypeResolver resolves documented parameter and return types through TypeRegistry. ConfigurationModuleMembersProvider delegates method type resolution to it.
Verify inferred parameter types
src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/CompletionProviderTest.java, src/test/java/com/github/_1c_syntax/bsl/languageserver/types/SeeMethodParameterRefInferenceTest.java
Completion expects the typed parameter signature. The integration test verifies that a См. reference infers Строка.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant ReferenceResolver
  participant ConfigurationModuleMembersProvider
  participant DescribedTypeResolver
  participant TypeRegistry
  ReferenceResolver->>ConfigurationModuleMembersProvider: Resolve common-module method parameter
  ConfigurationModuleMembersProvider->>DescribedTypeResolver: Resolve documented parameter type
  DescribedTypeResolver->>TypeRegistry: Resolve documented type name
  TypeRegistry-->>DescribedTypeResolver: Return Строка type
  DescribedTypeResolver-->>ConfigurationModuleMembersProvider: Provide parameter type
  ConfigurationModuleMembersProvider-->>ReferenceResolver: Return inferred parameter type
Loading
🚥 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 describes type inference for «См.» references to method parameters in another module, which is the main change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/types-see-ref-method-parameter

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.

Тип объявлен в описании метода явно, поэтому виден и в сигнатуре подсказки:
«(Значение: Произвольный): Массив». Ожидание теста автодополнения обновлено.
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Test Results

 3 996 files  +6   3 996 suites  +6   51m 49s ⏱️ - 1m 4s
 4 136 tests +1   4 065 ✅ +1   71 💤 ±0  0 ❌ ±0 
24 816 runs  +6  24 386 ✅ +6  430 💤 ±0  0 ❌ ±0 

Results for commit 62625cb. ± Comparison against base commit d5c24f9.

♻️ This comment has been updated with latest results.

nixel2007 and others added 2 commits August 3, 2026 11:18
Убрана мёртвая проверка на null, регулярка вынесена в константу Pattern,
общий разбор имени типа для параметров и возвращаемого значения — в одном месте.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015awbqkuFMyTddXSsVuoHhc
…онент

Разрешение типов параметров и возвращаемого значения из документирующего
комментария вынесено в DescribedTypeResolver: ConfigurationModuleMembersProvider
занимается регистрацией типов модулей, а не разбором описаний.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015awbqkuFMyTddXSsVuoHhc
@nixel2007
nixel2007 merged commit c9268d0 into develop Aug 3, 2026
37 checks passed
@nixel2007
nixel2007 deleted the feat/types-see-ref-method-parameter branch August 3, 2026 10:43
@sonarqubecloud

sonarqubecloud Bot commented Aug 3, 2026

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.

1 participant