feat!: Add support for preserving block comment locations. (#8231)

* feat: Add support for preserving block comment locations.

* chore: format the tests.
This commit is contained in:
Aaron Dodson
2024-06-27 11:11:45 -07:00
committed by GitHub
parent b0b7d78ad0
commit 989c91f626
6 changed files with 158 additions and 5 deletions

View File

@@ -8,6 +8,7 @@ import {IconType} from '../icons/icon_types.js';
import {CommentState} from '../icons/comment_icon.js';
import {IIcon, isIcon} from './i_icon.js';
import {Size} from '../utils/size.js';
import {Coordinate} from '../utils/coordinate.js';
import {IHasBubble, hasBubble} from './i_has_bubble.js';
import {ISerializable, isSerializable} from './i_serializable.js';
@@ -20,6 +21,10 @@ export interface ICommentIcon extends IIcon, IHasBubble, ISerializable {
getBubbleSize(): Size;
setBubbleLocation(location: Coordinate): void;
getBubbleLocation(): Coordinate | undefined;
saveState(): CommentState;
loadState(state: CommentState): void;
@@ -35,6 +40,8 @@ export function isCommentIcon(obj: Object): obj is ICommentIcon {
(obj as any)['getText'] !== undefined &&
(obj as any)['setBubbleSize'] !== undefined &&
(obj as any)['getBubbleSize'] !== undefined &&
(obj as any)['setBubbleLocation'] !== undefined &&
(obj as any)['getBubbleLocation'] !== undefined &&
obj.getType() === IconType.COMMENT
);
}