Skip to content

refactor(hover): keyword'ы — synthetic KeywordSymbol + ReferenceFinder + Builder#3931

Merged
nixel2007 merged 1 commit into
1c-syntax:feature/type-system-v2from
sfaqer:feature/type-system-v2-keyword-symbol
May 22, 2026
Merged

refactor(hover): keyword'ы — synthetic KeywordSymbol + ReferenceFinder + Builder#3931
nixel2007 merged 1 commit into
1c-syntax:feature/type-system-v2from
sfaqer:feature/type-system-v2-keyword-symbol

Conversation

@sfaqer
Copy link
Copy Markdown
Member

@sfaqer sfaqer commented May 22, 2026

Follow-up к #3928. Замечание @nixel2007 (beep): разгрузить HoverProvider от keyword-специфики; принцип работы провайдера — три строчки (резолв ссылки → поиск маркап-билдера → делегирование). Keyword-обработка переезжает на этот же flow через synthetic-символ — аналог AnnotationSymbol/AnnotationReferenceFinder из #3906.

Что сделано

KeywordSymbol (context.symbol)

Synthetic Symbol с готовым уже локализованным description и selectionRange. SymbolKind = Operator. В symbol-tree не входит (accept = no-op).

KeywordReferenceFinder (references, @Order(190))

По позиции находит terminal-node, фильтрует не-keyword токены (IDENTIFIER/STRING/DECIMAL/FLOAT/DATETIME/EOF), определяет parent-context (Функция/Процедура/Перем) обходом AST, через GlobalScopeProvider.findKeywordDescription(text, lang, parentContext) собирает KeywordSymbol + Reference. Логика isKeywordToken / findKeywordParentContext переехала сюда из HoverProvider без семантических изменений.

KeywordSymbolMarkupContentBuilder (hover)

Оборачивает уже выбранное описание в markdown:

```bsl
<keyword>
```

_<label>_

<description>

Resource bundle KeywordSymbolMarkupContentBuilder_{ru,en}.properties перенесён из providers/HoverProvider_*.properties (там был только keywordLabel).

HoverProvider

Удалены tryKeywordHover, findKeywordParentContext, isKeywordToken, инжекции GlobalScopeProvider/LanguageServerConfiguration/Resources. Остался только single-flow.

Test plan

  • *HoverProvider* + *Reference* зелёные локально.
  • Manual: hover на Если/Истина/Возврат/Async показывает то же описание, что и до рефакторинга.
  • Manual: hover на Возврат внутри Функция vs Процедура — разные описания (контекст-зависимость сохранена).

🤖 Generated with Claude Code

…r + Builder

Замечание @nixel2007: разгрузить HoverProvider от keyword-специфики.
Принцип работы провайдера — три строчки: резолв ссылки → поиск
маркап-билдера → делегирование. Keyword-обработка по этому же flow
через synthetic-символ (аналог AnnotationSymbol/AnnotationReferenceFinder
из PR 1c-syntax#3906).

- KeywordSymbol (context.symbol) — synthetic Symbol с name, готовым
  локализованным description и selectionRange. SymbolKind = Operator.
  В symbol-tree не входит (accept = no-op).
- KeywordReferenceFinder (references, @order 190): по позиции находит
  terminal-node, фильтрует не-keyword токены (IDENTIFIER/STRING/DECIMAL/
  FLOAT/DATETIME/EOF), определяет parent-context (Функция/Процедура/Перем)
  обходом AST, и через GlobalScopeProvider.findKeywordDescription строит
  KeywordSymbol + Reference. Логика isKeywordToken / findKeywordParentContext
  переехала сюда из HoverProvider без изменений.
- KeywordSymbolMarkupContentBuilder (hover): оборачивает уже выбранное
  описание в markdown ```bsl\n<keyword>\n```\n\n_<label>_\n\n<description>.
  Resource bundle KeywordSymbolMarkupContentBuilder_{ru,en}.properties
  перенесён из providers/HoverProvider_*.properties (там был только
  keywordLabel — больше провайдер ресурсов не запрашивает).
- HoverProvider: удалены tryKeywordHover, findKeywordParentContext,
  isKeywordToken, инжекции GlobalScopeProvider/LanguageServerConfiguration/
  Resources. Остался только single-flow: resolve reference → find builder
  → delegate.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0a9d0ea5-b89b-4d61-a29c-4b49f8db4b58

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@nixel2007 nixel2007 merged commit 6937233 into 1c-syntax:feature/type-system-v2 May 22, 2026
12 of 18 checks passed
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