feat(CompletionProvider): commitCharacters для членов и вызываемых#4091
Conversation
|
Warning Review limit reached
More reviews will be available in 12 minutes and 9 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ 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 |
|
Co-Authored-By: Claude Fable 5 <[email protected]>
91a2fa1 to
92055e8
Compare



Проблема
В
textDocument/completionпункты не задавалиcommitCharacters. Из-за этого клиент не мог фиксировать вызываемый вводом(или член-объект вводом.— нажатие такого символа не выбирало подсвеченный пункт и не вставляло его вместе с символом.Решение
Добавлен helper
applyCommitCharacters(CompletionItem), проставляющий набор поCompletionItemKind:Method/Function/Constructor→["("]— фиксация вставкой открывающей скобки;Field/Property/Variable/Module→["."]— осмысленно дальнейшее обращение к члену;Гейтинг по клиентской capability
completionItem.commitCharactersSupport: флаг кэшируется вhandleInitializeEventрядом соsnippetSupport/labelDetailsSupport/resolveSupport. Если клиент не объявил поддержку —commitCharactersне задаются вовсе. СерверныйtriggerCharacters(точка как триггер completion) не затрагивается — это отдельный механизм.Helper вызывается строго локально в местах выдачи item-ов:
buildMemberItem(члены dot-completion и глобальные функции), локальные методы/переменные документа, глобальные контексты и квалифицированные имена MD-объектов. Чужие правки (sortText, resolve, MarkupContent, labelDetails) не переформатированы.Тесты
Новые тесты в
CompletionProviderTest(red-first, затем реализация):methodMemberGetsOpenParenCommitCharacter— метод получает["("];propertyMemberGetsDotCommitCharacter— свойство получает["."];localVariableGetsDotCommitCharacter— локальная переменная получает["."];keywordHasNoCommitCharacters— ключевое слово безcommitCharacters;methodMemberHasNoCommitCharactersWhenClientLacksSupport— при клиенте безcommitCharactersSupportне задаются.Прогон:
./gradlew test --tests "...CompletionProviderTest"— 78 tests, 0 failures.🤖 Generated with Claude Code