Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

Адресованы замечания code review по оптимизации семантических токенов.

Рефакторинг констант

  • Извлечена TOKEN_SIZE = 5 как private static final на уровне класса вместо локальных переменных в методах
  • Убран лишний параметр tokenSize из findSuffixMatchWithOffset()

Улучшение читаемости

  • Переименована метка outerfindFirstDifference для ясности намерения
  • Убрана избыточная проверка if (deleteCount == 0 && deleteStart == insertEnd) — пустые edit валидны для LSP

Расширение тестового покрытия

Добавлены тесты, проверяющие корректность дельт через их применение к исходным данным:

  • Вставка строки в начале, в середине документа
  • Удаление строк
  • Вставка текста на той же строке (без перевода строки)
@Test
void deltaEdit_appliedToPreviousData_producesCurrentData() {
  // ... setup ...
  var delta = provider.getSemanticTokensFullDelta(context2, deltaParams);
  List<Integer> appliedData = applyEdit(tokens1.getData(), delta.getEdits().get(0));
  assertThat(appliedData).isEqualTo(tokens2.getData());  // Verify correctness
}

Все 38 тестов проходят успешно.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 28, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

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


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits December 28, 2025 11:14
…mprove tests

- Extract TOKEN_SIZE as class-level constant for consistency
- Rename 'outer' label to 'findFirstDifference' for clarity
- Remove unnecessary early return check in computeEdits
- Add comprehensive delta edit tests that verify correctness by applying edits
- Tests confirm that same-line text insertion (without line breaks) is handled correctly

Co-authored-by: nixel2007 <[email protected]>
- Remove extra blank lines for consistency
- Remove trailing empty line at end of file

Co-authored-by: nixel2007 <[email protected]>
Copilot AI changed the title [WIP] Optimize semantic token storage and delta calculation Рефакторинг кода семантических токенов: константа TOKEN_SIZE, улучшенные тесты Dec 28, 2025
Copilot AI requested a review from nixel2007 December 28, 2025 11:20
Base automatically changed from feature/optimize-delta-semantic-tokens to develop December 28, 2025 14:32
@nixel2007 nixel2007 closed this Dec 28, 2025
@nixel2007 nixel2007 deleted the copilot/sub-pr-3706-again branch December 30, 2025 10:43
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