Skip to content

Fix PR #3628 review comments: variable naming, JavaDoc, and test improvements#3632

Merged
nixel2007 merged 3 commits intofeature/handle-didChangeWatchedFilesfrom
copilot/fix-pull-request-comments-3628
Dec 1, 2025
Merged

Fix PR #3628 review comments: variable naming, JavaDoc, and test improvements#3632
nixel2007 merged 3 commits intofeature/handle-didChangeWatchedFilesfrom
copilot/fix-pull-request-comments-3628

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

Описание

Исправлены замечания код-ревью из PR #3628:

BSLWorkspaceService.java:

  • Переименование wasDocumentOpenedBeforeisDocumentOpened (3 места) — переменная отражает текущее состояние, не предыдущее
  • Изменение JavaDoc: "обработка не требуется" → "обработка пропускается" — явное указание на намеренный пропуск обработки для открытых файлов

BSLWorkspaceServiceTest.java:

  • Добавлена проверка удаления uri3 в testDidChangeWatchedFiles_MultipleEvents
  • Добавлена подготовка documentContext3 для корректной проверки удаления

Связанные задачи

Closes #3628

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Пример изменения переменной:

// Было
var wasDocumentOpenedBefore = serverContext.isDocumentOpened(documentContext);
if (!wasDocumentOpenedBefore) { ... }

// Стало
var isDocumentOpened = serverContext.isDocumentOpened(documentContext);
if (!isDocumentOpened) { ... }
Original prompt

исправь замечания в пулл-реквесте #3628


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 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.

…ovements

Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issues raised in pull request #3628 Fix PR #3628 review comments: variable naming, JavaDoc, and test improvements Dec 1, 2025
Copilot AI requested a review from nixel2007 December 1, 2025 16:19
@nixel2007 nixel2007 requested a review from Copilot December 1, 2025 17:20
@nixel2007 nixel2007 marked this pull request as ready for review December 1, 2025 17:20
await().pollDelay(Duration.ofMillis(200)).until(() -> true);
// Для открытого файла событие Created должно быть проигнорировано
// Ожидаем завершения асинхронной обработки
await().atMost(Duration.ofSeconds(2)).until(() -> true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot зачем в холостую ждать целых две секунды?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вернул оригинальное поведение с pollDelay. Оставил только улучшения для теста MultipleEvents (добавлена проверка удаления uri3). Исправлено в df5c71f.

Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses code review comments from PR #3628, focusing on improving variable naming, clarifying JavaDoc documentation, and enhancing test coverage. The changes improve code readability and test robustness for file system event handling in the BSL Language Server.

Key Changes:

  • Renamed wasDocumentOpenedBefore to isDocumentOpened to better reflect current state rather than historical state
  • Updated JavaDoc to use "обработка пропускается" (processing is skipped) instead of "обработка не требуется" (processing is not required) for clearer intent
  • Enhanced test coverage in testDidChangeWatchedFiles_MultipleEvents to verify file deletion behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLWorkspaceService.java Variable rename and JavaDoc improvements in file event handlers (handleDeletedFileEvent, handleCreatedFileEvent, handleChangedFileEvent)
src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLWorkspaceServiceTest.java Test improvements: replaced pollDelay with atMost, added uri3 deletion verification, added explanatory comments
Comments suppressed due to low confidence (4)

src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLWorkspaceServiceTest.java:99

  • The original code used pollDelay(Duration.ofMillis(200)) which ensured a minimum 200ms delay for async processing. The new code atMost(Duration.ofSeconds(2)).until(() -> true) will return immediately since the condition is always true, providing NO actual wait time.

This could lead to flaky tests as the async operation in didChangeWatchedFiles (line 92-105 in BSLWorkspaceService.java) might not complete before assertions run.

Consider using await().pollDelay(Duration.ofMillis(100)).atMost(Duration.ofSeconds(2)).until(() -> true) to maintain the minimum wait while also having a reasonable timeout.

    // then

src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLWorkspaceServiceTest.java:153

  • The original code used pollDelay(Duration.ofMillis(200)) which ensured a minimum 200ms delay for async processing. The new code atMost(Duration.ofSeconds(2)).until(() -> true) will return immediately since the condition is always true, providing NO actual wait time.

This could lead to flaky tests as the async operation in didChangeWatchedFiles (line 92-105 in BSLWorkspaceService.java) might not complete before assertions run.

Consider using await().pollDelay(Duration.ofMillis(100)).atMost(Duration.ofSeconds(2)).until(() -> true) to maintain the minimum wait while also having a reasonable timeout.

    // Документ должен остаться в контексте

src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLWorkspaceServiceTest.java:239

  • The original code used pollDelay(Duration.ofMillis(100)) which ensured a minimum 100ms delay for async processing. The new code atMost(Duration.ofSeconds(2)).until(() -> true) will return immediately since the condition is always true, providing NO actual wait time.

This could lead to flaky tests as the async operation in didChangeWatchedFiles (line 92-105 in BSLWorkspaceService.java) might not complete before assertions run.

Consider using await().pollDelay(Duration.ofMillis(100)).atMost(Duration.ofSeconds(2)).until(() -> true) to maintain the minimum wait while also having a reasonable timeout.
src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLWorkspaceServiceTest.java:126

  • The wait condition serverContext.getDocument(uri) != null will pass immediately because the document was already added to the context on line 113. This doesn't ensure that the async file change processing has completed.

Since the test is verifying that a changed (not opened) file is processed, consider checking a more specific condition such as document content being updated, or use a fixed delay with pollDelay similar to other tests in the file.

    assertThat(serverContext.getDocument(uri)).isNotNull();

Copilot AI requested a review from nixel2007 December 1, 2025 17:30
@nixel2007 nixel2007 merged commit 33e1f13 into feature/handle-didChangeWatchedFiles Dec 1, 2025
21 checks passed
@nixel2007 nixel2007 deleted the copilot/fix-pull-request-comments-3628 branch December 1, 2025 18:09
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.

3 participants