feat: add JSON serialization for workspace comments (#7927)

* feat: basic comment serializer

* bad: temporarily jam new comment classes into array

* chore: implement serializer

* chore: add serialization tests

* chore: JSDoc

* chore: unonly tests
This commit is contained in:
Beka Westberg
2024-03-20 19:40:27 +00:00
committed by GitHub
parent fd1a02ff37
commit 407ff44e18
5 changed files with 316 additions and 0 deletions

View File

@@ -53,6 +53,9 @@ export class WorkspaceComment {
) {
this.id = id && !workspace.getCommentById(id) ? id : idGenerator.genUid();
// TODO: File an issue to remove this once everything is migrated.
workspace.addTopComment(this as AnyDuringMigration);
// TODO(7909): Fire events.
}
@@ -162,6 +165,7 @@ export class WorkspaceComment {
/** Disposes of this comment. */
dispose() {
this.disposing = true;
this.workspace.removeTopComment(this as AnyDuringMigration);
this.disposed = true;
}