-
Notifications
You must be signed in to change notification settings - Fork 121
Support textDocument/semanticTokens/full/delta #3696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Co-authored-by: nixel2007 <[email protected]>
Co-authored-by: nixel2007 <[email protected]>
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java
Outdated
Show resolved
Hide resolved
...test/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProviderTest.java
Show resolved
Hide resolved
Co-authored-by: nixel2007 <[email protected]>
Co-authored-by: nixel2007 <[email protected]>
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java
Show resolved
Hide resolved
c7bfb5b to
dd1767d
Compare
|
@copilot проверь корректность заполнения delta, особенно расчет "deleteCount". Я вставил одну строку текста на ~25 символов в документ на 40000 строк и получил "deleteCount": 71942. Это не выглядит хоть сколько нибуть корректно. Не говоря уже о том, что время выполнения запроса увеличилось с 16 секунд до полутора минут. |
|
Co-authored-by: nixel2007 <[email protected]>
Добавил оптимизацию: теперь если размер delta >= размеру полных данных, возвращаются полные токены вместо delta. Это решает проблему с производительностью когда delta получается слишком большой (например, при вставке строки в начало документа все deltaLine меняются). Также добавил тесты для вставки в начало и середину документа (326065c). |
|
@copilot твоя оптимизация избыточная. Данные о токенах изначально лежат в виде дельт. Зачем вообще перепосылать все до конца? По идее нужно отправить только вставку, разве нет? |
… optimal delta Co-authored-by: nixel2007 <[email protected]>
Вы правы, оптимизация была избыточной. Алгоритм |
|
@copilot дельта меньше, но она все ещё огромная. Распиши детально свой алгоритм и сравни его с требованием спецификации |
Мой алгоритм
По спецификации LSP: Тесты показывают оптимальную работу:
Возможная причина Можете уточнить ваш сценарий? Какой текст вставляете и куда? Есть ли токены на той же строке с той же позиции? Также возможно проблема в том, что |
|
@copilot я копирую одну строку кода вместе с переводом строки и вставляю ее же. |
… issue Co-authored-by: nixel2007 <[email protected]>
Добавил debug логирование (e24445a). При включении DEBUG уровня для
Мои тесты показывают что при копировании строки дельта должна быть маленькой. Возможные причины большого
Можете запустить с DEBUG логами и поделиться результатом? |



Implements the LSP
textDocument/semanticTokens/full/deltaendpoint for incremental semantic token updates, reducing bandwidth and processing for large files.Changes Made
Semantic Tokens Delta Support
SemanticTokensProviderto support delta computation with resultId tracking usingConcurrentHashMapsemanticTokensFullDeltamethod inBSLTextDocumentServicegetSemanticTokensProvider()inBSLLanguageServerto advertise delta support viaSemanticTokensServerFull.setDelta(true)Document Close Event (AOP)
ServerContextDocumentClosedEventclass for document close notificationsisCloseDocumentCallpointcut inPointcuts.javaEventPublisherAspectto publish event whenServerContext.closeDocument()is calledSemanticTokensProviderlistens for bothServerContextDocumentClosedEventandServerContextDocumentRemovedEventfor automatic cache cleanupTesting
clearCachemethod protected for test accessOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.