Skip to content

fix(definition): переход к определению члена через source-defined символ дескриптора#4202

Merged
nixel2007 merged 1 commit into
developfrom
claude/fix-definition-source-defined-member
Jun 25, 2026
Merged

fix(definition): переход к определению члена через source-defined символ дескриптора#4202
nixel2007 merged 1 commit into
developfrom
claude/fix-definition-source-defined-member

Conversation

@nixel2007

@nixel2007 nixel2007 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Проблема

F12 (go-to-definition) на члене платформенного/конфигурационного типа, разрешённом через TypeService.memberAt в синтетический PlatformMemberSymbol, не срабатывал — хотя hover на нём работает.

Пример (библиотека asserts, fluent-цепочка):

Ожидаем.Что(Переменная).ИмеетТип("ДанныеСоставнойФормы");

Клик F12 на ИмеетТип молча ничего не делал.

Причина

Ссылку отдаёт PlatformMemberReferenceFinder (@order(200)), оборачивая член в синтетический PlatformMemberSymbol (он implements Symbol, но не SourceDefinedSymbol). DefinitionProvider фильтрует ссылки через Reference::isSourceDefinedSymbolReference → такой символ отсекается → F12 возвращает пустой список.

При этом для метода OneScript-класса дескриптор уже несёт source-defined символ-источник: OScriptModuleMembersProvider.toMemberDescriptor(...) вешает .withSourceSymbol(method). То есть данные для перехода уже на руках в момент запроса — DefinitionProvider их просто не читал.

Решение

Маленький Reference → Reference map (unwrapPlatformMemberSource) перед фильтром: если символ — PlatformMemberSymbol и у его дескриптора есть source-defined sourceSymbol, ссылка перенаправляется на источник; иначе возвращается без изменений. Основной пайплайн перехода не меняется.

Платформенные члены без символа-источника (например ТаблицаЗначений.Добавить) остаются PlatformMemberSymbol, отсекаются прежним фильтром → hover-only сохранён (у них нет объявления в исходниках).

Область

Только навигация (F12). Это подмножество более крупного обсуждения про индексацию type-inferred member-обращений для find-references/rename — см. #4197 (там анализ и дизайн, кода нет).

Тесты

DefinitionProviderUnitTest (Mockito, без подъёма ServerContext):

  • переход ведёт к символу-источнику (targetUri/targetRange/targetSelectionRange, origin = диапазон обращения к члену);
  • платформенный член без источника → перехода нет.

Прогон: DefinitionProviderUnitTest 2/2 ✅, DefinitionProviderTest 6/6 ✅ (поведение не сломано).

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • “Go to definition” now resolves platform/configuration members to their underlying source location when one is available.
    • If no source-backed location exists, definition lookup correctly returns no result.
  • Tests
    • Added coverage for definition resolution with and without an associated source-defined symbol.

…вол дескриптора

F12 на члене платформенного/конфигурационного типа, разрешённом через
TypeService.memberAt в синтетический PlatformMemberSymbol (например, метод
OneScript-класса в fluent-цепочке asserts: Ожидаем.Что(X).ИмеетТип(...)),
не срабатывал: DefinitionProvider отсекал такие ссылки фильтром
isSourceDefinedSymbolReference, хотя дескриптор уже несёт source-defined
символ-источник (OScriptModuleMembersProvider.withSourceSymbol).

Добавлен маленький Reference->Reference map (unwrapPlatformMemberSource),
разворачивающий ссылку на источник перед фильтром; основной пайплайн
перехода не меняется. Платформенные члены без источника остаются hover-only.

Обсуждение и дизайн: #4197

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KZQafLUdXJF7ZDqphzs6tX
@coderabbitai

coderabbitai Bot commented Jun 25, 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

Run ID: 11aad47a-0c26-4373-b59f-08589542ac35

📥 Commits

Reviewing files that changed from the base of the PR and between 3b180d5 and f5526cf.

📒 Files selected for processing (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DefinitionProvider.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/DefinitionProviderUnitTest.java

📝 Walkthrough

Walkthrough

DefinitionProvider now unwraps platform member references to their source-defined symbols before resolving definitions. New unit tests cover the source-backed and source-missing platform member cases.

Changes

Definition source unwrapping

Layer / File(s) Summary
Definition resolution unwrap
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DefinitionProvider.java
findLocationLinks unwraps PlatformMemberSymbol references to source-defined symbols before definition-link filtering.
DefinitionProvider tests
src/test/java/com/github/_1c_syntax/bsl/languageserver/providers/DefinitionProviderUnitTest.java
Tests cover a platform member with an attached source symbol, a platform member without one, and the mocked provider setup used by both cases.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through symbols, neat and true,
Found the source beneath the view.
One little unwrap, then tests did cheer,
Definition paths are bunny-clear.

🚥 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 Title clearly describes the definition-navigation fix and the source-defined descriptor symbol used in the implementation.
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 claude/fix-definition-source-defined-member

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.

@nixel2007
nixel2007 merged commit e1a14e9 into develop Jun 25, 2026
41 of 42 checks passed
@nixel2007
nixel2007 deleted the claude/fix-definition-source-defined-member branch June 25, 2026 14:14
@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