Skip to content

feat(semantictokens): async-модификатор для платформенных member-методов#3953

Merged
nixel2007 merged 1 commit into
developfrom
feature/async-modifier-platform-methods
May 27, 2026
Merged

feat(semantictokens): async-модификатор для платформенных member-методов#3953
nixel2007 merged 1 commit into
developfrom
feature/async-modifier-platform-methods

Conversation

@nixel2007

@nixel2007 nixel2007 commented May 27, 2026

Copy link
Copy Markdown
Member

Summary

После того как в develop появился MemberDescriptor.async, расширяю PlatformMemberMethodCallSemanticTokensSupplier чтобы сайт вызова async-метода платформенного типа получал не только Method + defaultLibrary, но ещё и стандартный модификатор async. Обычные методы остаются без async (как раньше).

Реализовано через flatMap-пару (range, descriptor) в виде Resolved-record и кэшированных статических массивов модификаторов (DEFAULT_LIBRARY_MODIFIERS / DEFAULT_LIBRARY_ASYNC_MODIFIERS).

Test plan

  • testModifiersForAsyncDescriptorMemberDescriptor.method("X").withAsync(true)[defaultLibrary, async]
  • testModifiersForRegularDescriptor — обычный MemberDescriptor.method("Y")[defaultLibrary]
  • Existing 4 интеграционных теста (Массив.Добавить и т.п.) — без регрессий
  • ./gradlew test --tests "*.semantictokens.*" --tests "*.SemanticTokensProviderTest" — зелёно

Production-фикстуры платформенных типов пока не содержат member-методов с async: true (флаг есть только у глобальных функций типа ВопросАсинх, которые обрабатывает PlatformGlobalMethodSemanticTokensSupplier). Поэтому путь Async-метод проверяется на уровне статического хелпера modifiers(...); как только в платформенной модели появятся async member-методы — подсветка заработает автоматически.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Improved semantic token handling for platform method calls: the language server now detects and applies appropriate semantic modifiers for asynchronous platform methods.
  • Tests

    • Added test coverage validating semantic token modifier selection for both regular and asynchronous platform method calls.

Review Change Stack

В develop добавили MemberDescriptor.async (#3950+followup). Используем
его в PlatformMemberMethodCallSemanticTokensSupplier:
- async-метод платформы (descriptor.async() == true) теперь получает
  Method + DefaultLibrary + Async на сайте вызова;
- обычный метод — Method + DefaultLibrary, без Async (как и было).

Реализовано через flatMap-пару (range, descriptor) в виде Resolved-record
и кэшированных статических массивов модификаторов
(DEFAULT_LIBRARY_MODIFIERS / DEFAULT_LIBRARY_ASYNC_MODIFIERS).

В тест добавлены два unit-кейса (testModifiersForAsyncDescriptor /
testModifiersForRegularDescriptor) на package-private modifiers(...) —
производственные платформенные типы пока async-методов не несут, поэтому
покрытие через type-инференс в integration-тесте сейчас невозможно.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Copilot AI review requested due to automatic review settings May 27, 2026 06:25
@coderabbitai

coderabbitai Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a496a75b-7456-4181-81e4-926d9ee44899

📥 Commits

Reviewing files that changed from the base of the PR and between 5d31e55 and ffc8cc5.

📒 Files selected for processing (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/PlatformMemberMethodCallSemanticTokensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/PlatformMemberMethodCallSemanticTokensSupplierTest.java

📝 Walkthrough

Walkthrough

PlatformMemberMethodCallSemanticTokensSupplier now resolves platform method descriptors to conditionally apply the Async modifier alongside DefaultLibrary. The implementation refactors from simple boolean checks to descriptor-based resolution, introduces a new modifiers(MemberDescriptor) helper, and adds unit test coverage validating async and non-async modifier selection.

Changes

Async modifier support for platform method calls

Layer / File(s) Summary
Async modifier resolution and token emission
src/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/PlatformMemberMethodCallSemanticTokensSupplier.java
Import MemberDescriptor, update javadoc to document Async modifier, add DEFAULT_LIBRARY_ASYNC_MODIFIERS constant, refactor token-collection logic to resolve platform methods to descriptors and select modifiers dynamically via new platformMethodAt(...) and modifiers(MemberDescriptor) helpers, and introduce internal Resolved record to pair range with descriptor.
Modifier selection unit tests
src/test/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/PlatformMemberMethodCallSemanticTokensSupplierTest.java
Import MemberDescriptor and add two unit tests directly validating PlatformMemberMethodCallSemanticTokensSupplier.modifiers(...) output: async methods receive both DefaultLibrary and Async modifiers, regular methods receive only DefaultLibrary.

Possibly Related PRs

  • 1c-syntax/bsl-language-server#3947: Both PRs extend semantic-token highlighting to include the Async modifier on method call sites (this PR via platform member method descriptor resolution, related PR via propagating isAsync() on method symbols and applying Async in method-call/declaration token suppliers).

Poem

🐰 A method's true nature now shines so bright,
Async or steady, we mark it just right,
Descriptors guide us through platform's domain,
Token by token, the modifiers reign! 🌟

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~12 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 accurately describes the main change: adding async modifier support for platform member methods in semantic tokens, which is the primary focus of the PR.
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.

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

✨ 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 feature/async-modifier-platform-methods

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.

Copilot AI 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.

Pull request overview

PR расширяет подсветку semantic tokens для вызовов member-методов платформенных типов: если резолвнутый MemberDescriptor помечен как async, к токену Method + DefaultLibrary добавляется модификатор Async. Это приводит поведение platform-member call sites в соответствие с уже существующей поддержкой async для глобальных платформенных функций и source-defined методов.

Changes:

  • Добавлен выбор набора semantic modifiers (DefaultLibrary vs DefaultLibrary+Async) на основе MemberDescriptor.async().
  • Рефакторинг резолва платформенного member-метода: вместо boolean-проверки теперь возвращается Optional<MemberDescriptor> и протаскивается вместе с range.
  • Добавлены unit-тесты для проверки выбора модификаторов для async/regular MemberDescriptor.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/PlatformMemberMethodCallSemanticTokensSupplier.java Добавляет Async-модификатор для вызовов async member-методов платформенных типов на основе MemberDescriptor.async().
src/test/java/com/github/_1c_syntax/bsl/languageserver/semantictokens/PlatformMemberMethodCallSemanticTokensSupplierTest.java Добавляет тесты, проверяющие выбор набора modifiers для async/обычного member-descriptor.

var mods = PlatformMemberMethodCallSemanticTokensSupplier.modifiers(asyncMethod);

// then — async-метод платформы получает DefaultLibrary + Async.
assertThat(mods).containsExactly(SemanticTokenModifiers.DefaultLibrary, SemanticTokenModifiers.Async);
@sonarqubecloud

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.

2 participants