Skip to content

feat(types): bilingual hover/completion/signature + вариадик-параметры#3942

Merged
nixel2007 merged 9 commits into
developfrom
feature/type-system-v2-stdattrs-bilingual
May 25, 2026
Merged

feat(types): bilingual hover/completion/signature + вариадик-параметры#3942
nixel2007 merged 9 commits into
developfrom
feature/type-system-v2-stdattrs-bilingual

Conversation

@sfaqer

@sfaqer sfaqer commented May 25, 2026

Copy link
Copy Markdown
Member

Завершение bilingual-поддержки type-system v2 и вариадик-параметров. Зависимость bsl-context поднята до 0.4.0 (новый флаг ContextSignatureParameter.isVariadic()).

Стандартные реквизиты MD-объектов (bilingual)

  • ConfigurationTypesProvider: имя/описание стандартных реквизитов — двуязычные (из MultiName), completion отдаёт реквизиты в языке ScriptVariant без дублей ru+en.
  • AssignToReadOnlyPropertyDiagnostic: убран pre-filter по имени — read-only резолвится по типу-владельцу, независимо от языка имени (Ссылка/Ref).

Унификация bilingual-модели членов

  • BuiltinPlatformTypesProvider.mergeBilingualPairs: соседние ru/en-члены дампа OneScript склеиваются в один двуязычный MemberDescriptor при загрузке.
  • CompletionProvider: удалён filterMembersByLanguage; лейбл, документация и сигнатура итемов следуют языку.

Язык интерфейса (hover / signature help) = настройки LS

ScriptVariant — язык исходников (форматтер, completion-итемы), а интерфейсные подсказки опираются на configuration.getLanguage():

  • VariableSymbolMarkupContentBuilder, SyntheticSymbolMarkupContentBuilder, SignatureHelpProvider — имена типов/параметров через displayName(lang), разделитель коллекции из/Of локализован.

Вариадик-параметры

Новый Структура("Ключи", З1, З2), СтрШаблон("%1 %2", a, b), Макс/Мин/Массив/ФорматированнаяСтрока:

  • ParameterDescriptor.variadic + JSON-поле variadic; подбор сигнатуры по флагу.
  • Инлей-хинты и signature help разворачивают вариадик-хвост в нумерованные Значение1/Значение2/… по фактическим аргументам; detail мульти-сигнатур и подсказки следуют языку.

Тесты обновлены/добавлены.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Language-aware completions, hovers and signature help (RU/EN); variadic-parameter expansion with numbered inlay hints.
  • Bug Fixes

    • More accurate, language-independent detection of assignments to read-only properties.
  • Improvements

    • Localized type names, parameter labels and documentation; enriched bilingual platform metadata and RU/EN merging.
  • Tests

    • Added/updated tests covering bilingual behavior, variadic expansion/numbering, signature/inlay rendering and completion localization.
  • Chores

    • Build dependency upgraded.

Review Change Stack

sfaqer and others added 3 commits May 25, 2026 21:06
Завершение bilingual-поддержки type-system v2 и вариадик-параметров.
Зависимость bsl-context поднята до 0.4.0 (флаг ContextSignatureParameter.isVariadic()).

Стандартные реквизиты MD-объектов (bilingual):
- ConfigurationTypesProvider: attributeBilingualName() из MultiName (ru+en),
  bilingual имя/описание членов; completion отдаёт реквизиты в языке ScriptVariant.
- AssignToReadOnlyPropertyDiagnostic: убран кривой pre-filter по имени —
  read-only резолвится по типу-владельцу, независимо от языка имени (Ссылка/Ref).
- builtin-platform-types.json: bilingual стандартные реквизиты Справочник/ДокументСсылка.

Унификация bilingual-модели членов:
- BuiltinPlatformTypesProvider.mergeBilingualPairs: соседние ru/en-члены OneScript-дампа
  склеиваются в один bilingual MemberDescriptor при загрузке.
- CompletionProvider: удалён filterMembersByLanguage; язык через member.displayName/
  displayDescription(scriptVariant); документация и сигнатура итемов следуют языку.

Язык интерфейса (hover/signature help) = настройки LS (configuration.getLanguage()),
а не ScriptVariant (язык исходников):
- VariableSymbolMarkupContentBuilder.renderRef, SyntheticSymbolMarkupContentBuilder,
  SignatureHelpProvider — имена типов/параметров через displayName(lang), разделитель
  коллекции «из»/«Of» локализован; TypeService.displayName(ref, lang).
- DocumentContext.getScriptVariantLanguage(): мягкий fallback на UI-язык при UNKNOWN.

Вариадик-параметры (Структура/ФиксСтруктура/СтрШаблон/Макс/Мин/Массив/ФорматированнаяСтрока):
- ParameterDescriptor.variadic + JSON-поле variadic; SignatureSelection по флагу.
- Инлей-хинты и signature help разворачивают вариадик-хвост в нумерованные
  Значение1/Значение2/… по фактическим аргументам.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
…адик

Review-замечания к PR #3940:
- CompletionProvider.formatSignaturesCount: для language=EN возвращает
  «N overloads» вместо русского «N вариантов синтаксиса» (detail completion-итема
  мульти-сигнатурного метода следует языку проекта).
- SignatureSelection.acceptsArity: нижняя граница вариадик-ветки — required,
  а не total-1 (обязательный вариадик-хвост, например Макс(Значение…), требует
  минимум один аргумент; раньше пропускался вызов без аргументов).

Тесты: multiSignatureDetailFollowsConfiguredLanguage,
pickIndexByTypesRequiredVariadicRejectsTooFewArgs;
ТаблицаЗначений.Скопировать в JSON-fallback получил вторую сигнатуру (реальная перегрузка).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
…ерка detail

- ParameterDescriptor: компактный конструктор нормализует null-поля через
  Objects.requireNonNullElse (восстановлено; чинит canonicalConstructorNormalizesNulls).
- CompletionProviderTest: EN-detail мульти-сигнатур проверяется паттерном «N overload(s)».

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR makes the server UI language-aware, adds variadic parameter support and numbering across UI features, enriches and merges bilingual builtin platform metadata, consolidates registry null/blank handling, and updates tests and a dependency.

Changes

Language-aware APIs and bilingual metadata support

Layer / File(s) Summary
Dependency upgrade and ParameterDescriptor variadic extension
build.gradle.kts, src/main/java/com/github/_1c_syntax/bsl/languageserver/types/model/ParameterDescriptor.java
Updates bsl-context to 0.4.0; extends ParameterDescriptor with a variadic boolean, normalizes nullable bilingual/default fields via Objects.requireNonNullElse, adds withVariadic(...), and updates compat constructors.
DocumentContext language-aware script variant resolution
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java
Adds getScriptVariantLanguage() returning Language, refactors getScriptVariantLocale() to delegate to it, and falls back to configured language for unknown variants.
TypeService display API and compact-constructor annotations
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/TypeService.java
Adds public displayName(TypeRef, Language) delegating to registry, updates imports, and annotates TypedMember compact constructors' owner param as @Nullable.
Hover builders language-aware rendering
src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/SyntheticSymbolMarkupContentBuilder.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java
Inject LanguageServerConfiguration, render inferred/value types via typeService.displayName(..., lang), and localize collection separators.
AssignToReadOnlyPropertyDiagnostic refactored resolution approach
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AssignToReadOnlyPropertyDiagnostic.java
Remove name-based pre-filter; resolve the assigned member via TypeService.findMemberAt(...) and check metadata().accessMode() == READ; add helper returning Optional and mark visitAssignment @Nullable.
Inlay hints variadic numbering and shadowing detection
src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/PlatformMethodCallInlayHintSupplier.java
Iterate call args with a variadic-aware resolver, number variadic tail param labels, skip blank/shadowing arguments, and build tooltips from resolved param names.
CompletionProvider script-variant-aware filtering and rendering
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/CompletionProvider.java
Make completion generation script-variant aware (dot/no-dot/global); use displayName(scriptVariant) for matching and rendering, propagate Language into detail/documentation builders, and localize overload/deprecation wording.
SignatureHelpProvider language-aware and variadic-expanded signature rendering
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SignatureHelpProvider.java
Inject LanguageServerConfiguration, compute argCount, expand variadic parameters into numbered labels, render parameter docs via displayDescription(lang), and localize type labels via typeService.displayName.
Registry providers blank/empty normalization & bilingual plumbing
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/*
Replace null guards with blank/empty checks, treat empty EN as empty-string, propagate BilingualString for platform descriptions, and read variadic flags from JSON into ParameterDescriptor.
BuiltinPlatformTypesProvider RU/EN member merging
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/BuiltinPlatformTypesProvider.java
Read descriptionRu/descriptionEn, post-process adjacent RU/EN mono members into bilingual MemberDescriptors by fingerprint and script detection, merge signatures and parameter bilingual names, and set variadic flags from JSON.
Builtin platform types JSON bilingual & variadic enrichment
src/main/resources/com/github/_1c_syntax/bsl/languageserver/types/registry/builtin-platform-types.json
Add bilingual nameRu/nameEn and descriptionRu/descriptionEn, add Array constructors with variadic ElementCount, expand ValueTable.Copy overloads, and mark many reference properties as read-only with accessMode: "READ" and explicit return types.
SignatureSelection variadic handling
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/util/SignatureSelection.java
Switch to ParameterDescriptor.variadic() semantics for overload selection and adjust scoring/arity checks accordingly.
Tests: language/variadic coverage
src/test/java/...
Update and add tests for diagnostics, hover, inlay hints, completion, signature help, builtin types merging, configuration provider bilingual behavior, and signature-selection variadic cases.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

hacktoberfest-accepted

Suggested reviewers

  • nixel2007
  • theshadowco

Poem

🐇 I hop through code in bilingual cheer,

variadic tails now counted clear.
Hovers choose RU or EN light,
Completions and signatures sing right —
platform metadata gleams day and night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.47% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main changes: bilingual support for hover/completion/signature features and variadic parameter support, with the Russian term 'вариадик-параметры' reflecting the actual implementation changes throughout the codebase.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/type-system-v2-stdattrs-bilingual

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 and usage tips.

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/util/SignatureSelection.java (1)

51-68: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make pickIndexByArity variadic-aware.

The method still enforces a fixed upper bound (argCount <= total), so valid variadic calls can be rejected in arity-only selection paths.

Proposed fix
 public static int pickIndexByArity(List<SignatureDescriptor> signatures, int argCount) {
   if (signatures.isEmpty() || argCount < 0) {
     return -1;
   }
   int fallback = -1;
   for (int i = 0; i < signatures.size(); i++) {
     var sig = signatures.get(i);
-    int total = sig.parameters().size();
-    int required = (int) sig.parameters().stream().filter(p -> !p.optional()).count();
-    if (argCount >= required && argCount <= total) {
+    if (acceptsArity(sig, argCount)) {
       return i;
     }
+    int total = sig.parameters().size();
     if (fallback == -1 && total == argCount) {
       fallback = i;
     }
   }
   return fallback;
 }

Also applies to: 120-143

🤖 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/main/java/com/github/_1c_syntax/bsl/languageserver/types/util/SignatureSelection.java`
around lines 51 - 68, pickIndexByArity currently rejects calls that exceed the
fixed total parameter count even when a signature is variadic; update the logic
to detect a variadic parameter (e.g., check the last parameter's variadic flag
via parameter.variadic() or similar) and allow argCount >= required when the
signature is variadic (treat total as unbounded in that case). Adjust the
matching condition in pickIndexByArity to accept signatures when (argCount >=
required && (argCount <= total || hasVariadic)), and ensure the fallback
assignment (fallback = i when total == argCount) does not override a variadic
match—only use fallback for non-variadic exact-total matches.
src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/BuiltinPlatformTypesProvider.java (1)

435-463: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Parse bilingual signature descriptions too.

readSignatures still only consumes the mono description field, so the new JSON constructor/overload docs can only ever be Russian in fallback mode. That leaves English signature help incomplete even though SignatureDescriptor already supports bilingual descriptions elsewhere in this provider.

💡 Suggested direction
   for (var sig : raw) {
-      var description = (String) sig.getOrDefault("description", "");
+      var description = (String) sig.getOrDefault("description", "");
+      var descriptionRu = stringField(sig, "descriptionRu");
+      var descriptionEn = stringField(sig, "descriptionEn");
       var returnTypeName = (String) sig.get("returnType");
       var returnType = returnTypeName == null
         ? fallbackReturnType
         : new TypeRef(TypeKind.PLATFORM, returnTypeName);
@@
-      result.add(new SignatureDescriptor(params, returnType, description));
+      var ru = descriptionRu.isEmpty() ? description : descriptionRu;
+      result.add(new SignatureDescriptor(params, returnType, BilingualString.of(ru, descriptionEn)));
   }

Then the JSON signatures added in this PR can move to descriptionRu / descriptionEn.

🤖 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/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/BuiltinPlatformTypesProvider.java`
around lines 435 - 463, readSignatures currently only reads mono "description"
and so always produces a single-language signature; update it to parse
"descriptionRu" and "descriptionEn" (using the existing stringField helper
similar to pNameRu/pNameEn) and construct a BilingualString for the signature
description, then pass that bilingual description into the SignatureDescriptor
(use the overload/constructor that accepts a BilingualString or setDescription
accordingly) instead of the mono description variable so both Russian and
English signature help are emitted.
🤖 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`:
- Line 283: The code computes scriptVariant via
documentContext.getScriptVariantLanguage() but filterNamesByLanguage(...) still
uses configuration.getLanguage(); update the call site so that
filterNamesByLanguage and any helper isInConfiguredLanguage reference the
scriptVariant (the per-document script variant) instead of
configuration.getLanguage(), i.e. pass or use scriptVariant where language
selection for no-dot alias filtering occurs (look around the variable
scriptVariant, filterNamesByLanguage(...), and isInConfiguredLanguage to
replace/globalize the language source).

In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SignatureHelpProvider.java`:
- Around line 574-577: argCount currently counts all parser-produced callParam
nodes including empty ones; update argCount(DoCallContext doCall) to iterate
over paramList.callParam() and count only those entries that are non-empty
(e.g., filter out params whose getText().trim().isEmpty() or that lack an
expression child) so signature help uses the true number of provided arguments;
modify the method to return 0 when callParamList is null and otherwise return
the count of callParam elements passing the non-empty check.

In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/types/model/ParameterDescriptor.java`:
- Around line 69-72: The compat constructor for ParameterDescriptor can NPE
because it calls bilingualName.isEmpty() before record-level normalization;
change that check to be null-safe (e.g., treat null the same as empty) so the
ternary becomes (bilingualName == null || bilingualName.isEmpty()) ?
BilingualString.of(name) : bilingualName and keep the rest of the parameters the
same (types, optional, BilingualString.of(description), defaultValue) to ensure
null bilingualName is handled consistently in the constructor.

In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/ConfigurationTypesProvider.java`:
- Around line 473-476: The helper registerWithAlias currently registers an empty
English alias when callers pass ""—prevent this by checking the alias string
before calling typeRegistry.registerConfigurationTypeAlias: in
registerWithAlias(String qualifiedRu, String qualifiedEn) only call
typeRegistry.registerConfigurationTypeAlias(qualifiedEn, ref) if qualifiedEn is
not null and not blank (e.g., !qualifiedEn.isBlank() or !qualifiedEn.isEmpty()
after trimming); leave the original
typeRegistry.registerConfigurationType(qualifiedRu) behavior unchanged.

In
`@src/main/resources/com/github/_1c_syntax/bsl/languageserver/types/registry/builtin-platform-types.json`:
- Around line 433-436: The overload for "Скопировать/Copy" only includes Russian
parameter names ("Строки", "Колонки"); add English equivalents by supplying
nameEn for the signature and for each parameter in that overload (use nameEn:
"Rows" and nameEn: "Columns"), or replace the parameter objects to include both
nameRu and nameEn fields so the parser can show English names in fallback mode;
update the parameters array in the existing overload entry (the objects
containing "Строки" and "Колонки") to include nameEn properties accordingly.

---

Outside diff comments:
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/BuiltinPlatformTypesProvider.java`:
- Around line 435-463: readSignatures currently only reads mono "description"
and so always produces a single-language signature; update it to parse
"descriptionRu" and "descriptionEn" (using the existing stringField helper
similar to pNameRu/pNameEn) and construct a BilingualString for the signature
description, then pass that bilingual description into the SignatureDescriptor
(use the overload/constructor that accepts a BilingualString or setDescription
accordingly) instead of the mono description variable so both Russian and
English signature help are emitted.

In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/types/util/SignatureSelection.java`:
- Around line 51-68: pickIndexByArity currently rejects calls that exceed the
fixed total parameter count even when a signature is variadic; update the logic
to detect a variadic parameter (e.g., check the last parameter's variadic flag
via parameter.variadic() or similar) and allow argCount >= required when the
signature is variadic (treat total as unbounded in that case). Adjust the
matching condition in pickIndexByArity to accept signatures when (argCount >=
required && (argCount <= total || hasVariadic)), and ensure the fallback
assignment (fallback = i when total == argCount) does not override a variadic
match—only use fallback for non-variadic exact-total matches.
🪄 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: cf3ea5a4-6519-43e9-bce0-bbbd7fe85752

📥 Commits

Reviewing files that changed from the base of the PR and between a0ec2f7 and ba4dc50.

⛔ Files ignored due to path filters (1)
  • src/test/resources/diagnostics/AssignToReadOnlyPropertyDiagnostic.bsl is excluded by !src/test/resources/**
📒 Files selected for processing (23)
  • build.gradle.kts
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AssignToReadOnlyPropertyDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/SyntheticSymbolMarkupContentBuilder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/VariableSymbolMarkupContentBuilder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/PlatformMethodCallInlayHintSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/CompletionProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SignatureHelpProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/TypeService.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/model/ParameterDescriptor.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/BslContextPlatformTypesProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/BuiltinPlatformTypesProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/registry/ConfigurationTypesProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/types/util/SignatureSelection.java
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/types/registry/builtin-platform-types.json
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AssignToReadOnlyPropertyDiagnosticTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/SyntheticSymbolMarkupContentBuilderTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/PlatformMethodCallInlayHintSupplierTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/CompletionProviderTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/SignatureHelpProviderTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/types/registry/BuiltinPlatformTypesProviderTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/types/registry/ConfigurationTypesProviderTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/types/util/SignatureSelectionTest.java

@github-actions

github-actions Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Test Results

 2 844 files  ± 0   2 844 suites  ±0   1h 17m 31s ⏱️ + 3m 49s
 2 463 tests + 9   2 463 ✅ + 9  0 💤 ±0  0 ❌ ±0 
14 778 runs  +54  14 778 ✅ +54  0 💤 ±0  0 ❌ ±0 

Results for commit 8136a69. ± Comparison against base commit a0ec2f7.

This pull request removes 1 and adds 10 tests. Note that renamed tests count towards both.
com.github._1c_syntax.bsl.languageserver.types.registry.ConfigurationTypesProviderTest ‑ standardAttributeNamesFollowLanguageAtCallTime()
com.github._1c_syntax.bsl.languageserver.inlayhints.PlatformMethodCallInlayHintSupplierTest ‑ variadicConstructorHintsAreNumbered()
com.github._1c_syntax.bsl.languageserver.providers.CompletionProviderTest ‑ dotCompletionMemberDocumentationAndSignatureFollowConfiguredLanguageEn()
com.github._1c_syntax.bsl.languageserver.providers.CompletionProviderTest ‑ dotCompletionMemberDocumentationAndSignatureFollowConfiguredLanguageRu()
com.github._1c_syntax.bsl.languageserver.providers.CompletionProviderTest ‑ multiSignatureDetailFollowsConfiguredLanguage()
com.github._1c_syntax.bsl.languageserver.providers.SignatureHelpProviderTest ‑ signatureHelpRendersInConfiguredLanguageEn()
com.github._1c_syntax.bsl.languageserver.providers.SignatureHelpProviderTest ‑ variadicConstructorSignatureExpandsNumberedParameters()
com.github._1c_syntax.bsl.languageserver.types.registry.BuiltinPlatformTypesProviderTest ‑ oscriptBilingualMemberPairsAreMergedIntoSingleBilingualMember()
com.github._1c_syntax.bsl.languageserver.types.registry.ConfigurationTypesProviderTest ‑ standardAttributeDescriptionsAreBilingual()
com.github._1c_syntax.bsl.languageserver.types.registry.ConfigurationTypesProviderTest ‑ standardAttributesAreBilingualIndependentOfConfiguredLanguage()
com.github._1c_syntax.bsl.languageserver.types.util.SignatureSelectionTest ‑ pickIndexByTypesRequiredVariadicRejectsTooFewArgs()

♻️ This comment has been updated with latest results.

sfaqer and others added 2 commits May 25, 2026 23:10
Review-замечания:
- CompletionProvider: filterNamesByLanguage/isInConfiguredLanguage используют язык
  ScriptVariant документа (как остальной completion), а не configuration.getLanguage();
  убран инлайн-FQN FileType (импорт).
- SignatureHelpProvider.argCount: считает только непустые аргументы; убран FQN Tuple (импорт).
- ParameterDescriptor: null-safe компат-конструктор (nameOrFallback), порядок конструкторов.
- ConfigurationTypesProvider.registerWithAlias: не регистрирует пустой en-алиас.
- SignatureSelection.pickIndexByArity: учитывает вариадик (argCount >= required без верхней границы).
- BuiltinPlatformTypesProvider.readSignatures: двуязычное описание сигнатуры (descriptionRu/En).
- ТаблицаЗначений.Скопировать (JSON-fallback): nameEn параметров + вторая перегрузка.

Sonar:
- appendHints разбит на paramAt/appendHint (Cognitive Complexity, break/continue, var).
- scoreByTypes разбит на scoreOne/scoreVariadicTail (вложенность).
- isLatin/isCyrillic через chars() (число операторов в выражении).
- Убраны неиспользуемые импорты (TypeService, CompletionProvider), упрощены always-false проверки,
  var вместо явных типов, parens для precedence, isZero()/join-assertions/text-block в тестах.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
- AssignToReadOnlyPropertyDiagnostic: резолв read-only-свойства вынесен в
  readOnlyProperty(...) — число return'ов ≤5 (S1142); propertyName убран (S1941).
- TypeService.TypedMember: компат-конструкторы помечают owner как @nullable (S4449).
- BuiltinPlatformTypesProvider: магическое 2 → константа PAIR_SIZE (S109).
- CompletionProvider: объявление scriptVariant перенесено ближе к использованию (S1941).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
// У платформенных/конфигурационных членов source-символа нет, поэтому
// берём bilingual-описание в языке ScriptVariant, иначе документация
// всегда оставалась бы на русском (primary).
var sourceDoc = member.getSourceSymbol().isPresent()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

orElseGet идиоматичнее

sfaqer and others added 4 commits May 25, 2026 23:54
- BuiltinPlatformTypesProvider: isBilingualPair разбит (isCyrillicName/isLatinName) —
  число операторов (S1067); isLatin через блок BASIC_LATIN вместо магического 128 (S109);
  bilingualOrMono вынесен из вложенного тернара readSignatures (S3358).
- SignatureSelection.pickIndexByArity переиспользует acceptsArity (Cyclomatic Complexity, S1541).
- CompletionProvider.isInConfiguredLanguage сделан static, классификация символов вынесена
  в isCyrillic/isAsciiLetter (S1541, S2325).
- SignatureHelpProvider: argCount через ParseTree::getText (S1612), счётчики циклов var (S6212).
- PlatformMethodCallInlayHintSupplier.paramAt помечен @nullable (S2637/S2583/S2589).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
…449)

positionInside получал результат повторного accessProperty.IDENTIFIER(), который
анализатор считал возможно-null. Резолвим propertyId один раз через тернар — без
повторного вызова и без лишнего return (≤5).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
- CompletionProvider.isInConfiguredLanguage: явные скобки в тернаре (S864).
- PlatformMethodCallInlayHintSupplier.appendHint: убрана always-false проверка
  callParam.getText() == null (getText() не возвращает null) (S2589).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
…ingualOrMono)

Сигнатура Скопировать(Строки, Колонки) получила descriptionRu/descriptionEn —
покрывает bilingual-ветку readSignatures и даёт английское описание варианта в hover/signature help.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@nixel2007
nixel2007 merged commit 3e052e3 into develop May 25, 2026
39 checks passed
@nixel2007
nixel2007 deleted the feature/type-system-v2-stdattrs-bilingual branch May 25, 2026 16:58
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.

2 participants