refactor(hover): keyword'ы — synthetic KeywordSymbol + ReferenceFinder + Builder#3931
Merged
nixel2007 merged 1 commit intoMay 22, 2026
Conversation
…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.
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
6937233
into
1c-syntax:feature/type-system-v2
12 of 18 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Resource bundle
KeywordSymbolMarkupContentBuilder_{ru,en}.propertiesперенесён изproviders/HoverProvider_*.properties(там был толькоkeywordLabel).HoverProviderУдалены
tryKeywordHover,findKeywordParentContext,isKeywordToken, инжекцииGlobalScopeProvider/LanguageServerConfiguration/Resources. Остался только single-flow.Test plan
*HoverProvider*+*Reference*зелёные локально.Если/Истина/Возврат/Asyncпоказывает то же описание, что и до рефакторинга.ВозвратвнутриФункцияvsПроцедура— разные описания (контекст-зависимость сохранена).🤖 Generated with Claude Code