fix(editor): time issues of comment initialization (#13031)

#### PR Dependency Tree


* **PR #13031** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added the ability to filter comments by their resolution status
(resolved, unresolved, or all) when viewing or managing comments.

* **Refactor**
* Improved the way commented text is identified and retrieved, resulting
in more reliable comment selection and filtering.
* Enhanced comment retrieval to support asynchronous data loading,
ensuring up-to-date comment information.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
L-Sun
2025-07-04 16:19:00 +08:00
committed by GitHub
parent a485ad5c45
commit eb56adea46
7 changed files with 111 additions and 68 deletions
@@ -244,8 +244,14 @@ export function mockCommentProvider() {
this.commentHighlightSubject.next(id);
}
getComments() {
return Array.from(this.comments.keys());
getComments(type: 'resolved' | 'unresolved' | 'all' = 'all') {
return Array.from(this.comments.entries())
.filter(([_, comment]) => {
if (type === 'all') return true;
if (type === 'resolved') return comment.resolved;
return !comment.resolved;
})
.map(([id]) => id);
}
onCommentAdded(