@opensumi/ide-comments 2.21.13 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/lib/browser/comments-feature.registry.js.map +1 -1
  2. package/lib/browser/comments-panel.view.d.ts +2 -3
  3. package/lib/browser/comments-panel.view.d.ts.map +1 -1
  4. package/lib/browser/comments-panel.view.js +32 -70
  5. package/lib/browser/comments-panel.view.js.map +1 -1
  6. package/lib/browser/comments-thread.d.ts +4 -2
  7. package/lib/browser/comments-thread.d.ts.map +1 -1
  8. package/lib/browser/comments-thread.js +14 -7
  9. package/lib/browser/comments-thread.js.map +1 -1
  10. package/lib/browser/comments-zone.service.js.map +1 -1
  11. package/lib/browser/comments-zone.view.d.ts +1 -1
  12. package/lib/browser/comments-zone.view.d.ts.map +1 -1
  13. package/lib/browser/comments-zone.view.js +1 -1
  14. package/lib/browser/comments-zone.view.js.map +1 -1
  15. package/lib/browser/comments.contribution.d.ts +1 -0
  16. package/lib/browser/comments.contribution.d.ts.map +1 -1
  17. package/lib/browser/comments.contribution.js +6 -1
  18. package/lib/browser/comments.contribution.js.map +1 -1
  19. package/lib/browser/comments.service.d.ts +7 -4
  20. package/lib/browser/comments.service.d.ts.map +1 -1
  21. package/lib/browser/comments.service.js +60 -87
  22. package/lib/browser/comments.service.js.map +1 -1
  23. package/lib/browser/index.d.ts +0 -1
  24. package/lib/browser/index.d.ts.map +1 -1
  25. package/lib/browser/index.js +5 -1
  26. package/lib/browser/index.js.map +1 -1
  27. package/lib/browser/tree/comment-node.d.ts +14 -0
  28. package/lib/browser/tree/comment-node.d.ts.map +1 -0
  29. package/lib/browser/tree/comment-node.js +64 -0
  30. package/lib/browser/tree/comment-node.js.map +1 -0
  31. package/lib/browser/tree/tree-model.service.d.ts +43 -0
  32. package/lib/browser/tree/tree-model.service.d.ts.map +1 -0
  33. package/lib/browser/tree/tree-model.service.js +150 -0
  34. package/lib/browser/tree/tree-model.service.js.map +1 -0
  35. package/lib/browser/tree/tree-node.defined.d.ts +61 -0
  36. package/lib/browser/tree/tree-node.defined.d.ts.map +1 -0
  37. package/lib/browser/tree/tree-node.defined.js +116 -0
  38. package/lib/browser/tree/tree-node.defined.js.map +1 -0
  39. package/lib/browser/tree/tree-node.module.less +154 -0
  40. package/lib/common/index.d.ts +38 -36
  41. package/lib/common/index.d.ts.map +1 -1
  42. package/lib/common/index.js.map +1 -1
  43. package/package.json +13 -12
  44. package/src/browser/comment-reactions.view.tsx +109 -0
  45. package/src/browser/comments-body.tsx +57 -0
  46. package/src/browser/comments-feature.registry.ts +91 -0
  47. package/src/browser/comments-item.view.tsx +362 -0
  48. package/src/browser/comments-panel.view.tsx +90 -0
  49. package/src/browser/comments-textarea.view.tsx +194 -0
  50. package/src/browser/comments-thread.ts +309 -0
  51. package/src/browser/comments-zone.service.ts +29 -0
  52. package/src/browser/comments-zone.view.tsx +206 -0
  53. package/src/browser/comments.contribution.ts +201 -0
  54. package/src/browser/comments.module.less +210 -0
  55. package/src/browser/comments.service.ts +546 -0
  56. package/src/browser/index.ts +29 -0
  57. package/src/browser/markdown.style.ts +25 -0
  58. package/src/browser/mentions.style.ts +55 -0
  59. package/src/browser/tree/comment-node.tsx +130 -0
  60. package/src/browser/tree/tree-model.service.ts +173 -0
  61. package/src/browser/tree/tree-node.defined.ts +167 -0
  62. package/src/browser/tree/tree-node.module.less +154 -0
  63. package/src/common/index.ts +710 -0
  64. package/src/index.ts +1 -0
@@ -0,0 +1,710 @@
1
+ import React from 'react';
2
+
3
+ import type { ITree, ITreeNode } from '@opensumi/ide-components';
4
+ import {
5
+ IRange,
6
+ URI,
7
+ IDisposable,
8
+ MaybePromise,
9
+ Event,
10
+ BasicEvent,
11
+ positionToRange,
12
+ IContextKeyService,
13
+ IMarkdownString,
14
+ } from '@opensumi/ide-core-browser';
15
+ import { IEditor } from '@opensumi/ide-editor';
16
+ // eslint-disable-next-line import/no-restricted-paths
17
+ import type { IEditorDocumentModel } from '@opensumi/ide-editor/lib/browser/doc-model/types';
18
+
19
+ export type Writable<T> = { -readonly [P in keyof T]: T[P] };
20
+
21
+ /**
22
+ * @deprecated please use `positionToRange` from '@opensumi/ide-core-common`
23
+ */
24
+ export const toRange = positionToRange;
25
+
26
+ /**
27
+ * 点击评论菜单贡献点默认加入当前 menuId 作为标识
28
+ */
29
+ interface ICommentsMenuContext {
30
+ /**
31
+ * 注册在 menu 的 id
32
+ */
33
+ menuId: string;
34
+ }
35
+
36
+ export interface ICommentsTreeNode extends ITreeNode {
37
+ /**
38
+ * 子节点对应的 thread
39
+ */
40
+ readonly thread: ICommentsThread;
41
+ /**
42
+ * 子节点 `CommentContentNode` 及 `CommentReplyNode` 对应的 comment
43
+ * 如果是 CommentFileNode 则为 undefined
44
+ */
45
+ comment?: IComment;
46
+ }
47
+
48
+ /**
49
+ * 评论树的节点
50
+ */
51
+ export interface IWriteableCommentsTreeNode extends Writable<ICommentsTreeNode> {
52
+ /**
53
+ * 修改节点 name 区域展示内容
54
+ */
55
+ label: string | React.ReactNode;
56
+ /**
57
+ * 修改节点 description 区域展示内容
58
+ */
59
+ description: string | React.ReactNode;
60
+ /**
61
+ * 点击事件
62
+ */
63
+ onSelect?: (node: ICommentsTreeNode) => void;
64
+ }
65
+
66
+ /**
67
+ * 评论模式
68
+ */
69
+ export enum CommentMode {
70
+ /**
71
+ * 编辑状态
72
+ */
73
+ Editor = 0,
74
+ /**
75
+ * 预览状态
76
+ */
77
+ Preview = 1,
78
+ }
79
+
80
+ /**
81
+ * thread 展开模式
82
+ */
83
+ export enum CommentThreadCollapsibleState {
84
+ /**
85
+ * 收起状态
86
+ */
87
+ Collapsed = 0,
88
+ /**
89
+ * 展开状态
90
+ */
91
+ Expanded = 1,
92
+ }
93
+
94
+ /**
95
+ * editor gutter 的类型
96
+ */
97
+ export enum CommentGutterType {
98
+ /**
99
+ * 含有 thread 的 gutter,有黑点
100
+ */
101
+ Thread = 'thread',
102
+ /**
103
+ * 不含 thread 的 gutter,无黑点
104
+ */
105
+ Empty = 'empty',
106
+ }
107
+
108
+ export const CommentPanelId = 'CommentPanel';
109
+
110
+ /**
111
+ * 获取评论里的回复
112
+ */
113
+ export interface ICommentReply extends ICommentsMenuContext {
114
+ /**
115
+ * 当前 thread
116
+ */
117
+ thread: ICommentsThread;
118
+ /**
119
+ * 回复里的内容
120
+ */
121
+ text: string;
122
+ /**
123
+ * 当前 widget
124
+ */
125
+ widget: ICommentsZoneWidget;
126
+ }
127
+
128
+ export interface ICommentsZoneWidget {
129
+ /**
130
+ * widget 所在的 editor
131
+ */
132
+ coreEditor: IEditor;
133
+ /**
134
+ * 是否在展示
135
+ */
136
+ isShow: boolean;
137
+ /**
138
+ * 切换显隐
139
+ */
140
+ toggle(): void;
141
+ /**
142
+ * 设置为显示
143
+ */
144
+ show(): void;
145
+ /**
146
+ * 设置为隐藏
147
+ */
148
+ hide(): void;
149
+ /**
150
+ * 销毁
151
+ */
152
+ dispose(): void;
153
+ /**
154
+ * 重新设置 widget
155
+ * 会先 remove zone 再 append
156
+ */
157
+ resize(): void;
158
+ /**
159
+ * monaco 默认正只能写死 zone widget height,若要随着 view 变化进行高度的变化则需要删除重建
160
+ * 如果有此类操作则会触发该事件
161
+ */
162
+ onChangeZoneWidget: Event<IRange>;
163
+ /*
164
+ widget 展示的时候触发
165
+ */
166
+ onShow: Event<void>;
167
+ /**
168
+ * widget 隐藏的时候触发
169
+ */
170
+ onHide: Event<void>;
171
+ /**
172
+ * zone wiget 第一次显示的时候执行
173
+ */
174
+ onFirstDisplay: Event<number>;
175
+ }
176
+
177
+ export interface ICommentThreadTitle extends ICommentsMenuContext {
178
+ /**
179
+ * 当前 thread
180
+ */
181
+ thread: ICommentsThread;
182
+ /**
183
+ * 当前 widget
184
+ */
185
+ widget: ICommentsZoneWidget;
186
+ }
187
+
188
+ export interface ICommentAuthorInformation {
189
+ name: string;
190
+ iconPath?: URI | string;
191
+ }
192
+
193
+ /**
194
+ * 评论 Reaction
195
+ */
196
+ export interface CommentReaction {
197
+ /**
198
+ * 用于 title 提示
199
+ */
200
+ readonly label: string | undefined;
201
+
202
+ /**
203
+ * 显示的图标
204
+ */
205
+ readonly iconPath: string | URI;
206
+
207
+ /**
208
+ * 和当前 reaction 相关的用户数量
209
+ */
210
+ readonly count: number;
211
+
212
+ /**
213
+ * 点击此 reaction 是否需要反馈
214
+ */
215
+ readonly authorHasReacted: boolean;
216
+ }
217
+
218
+ export interface ICommentsCommentTitle extends ICommentsMenuContext {
219
+ /**
220
+ * 当前 thread
221
+ */
222
+ thread: ICommentsThread;
223
+ /**
224
+ * 当前评论
225
+ */
226
+ comment: IComment;
227
+ }
228
+
229
+ export interface ICommentsCommentContext extends ICommentsCommentTitle {
230
+ body: string | IMarkdownString;
231
+ }
232
+
233
+ /**
234
+ * 评论
235
+ */
236
+ export interface IComment {
237
+ /**
238
+ * 评论类型
239
+ */
240
+ mode?: CommentMode;
241
+ /**
242
+ * 评论内容
243
+ */
244
+ body: string | IMarkdownString;
245
+ /**
246
+ * 作者信息
247
+ */
248
+ author: ICommentAuthorInformation;
249
+ /**
250
+ * 附属显示
251
+ */
252
+ label?: string | React.ReactNode;
253
+ /**
254
+ * 添加附属数据
255
+ */
256
+ data?: any;
257
+ /**
258
+ * comment 的 context, key 为 comment
259
+ * 比如只想在某些 comment 贡献菜单,可以在 when 里写 comment == aaa
260
+ * 其中 aaa 就是 contextValue 的值
261
+ */
262
+ contextValue?: string;
263
+ /**
264
+ * 评论 reaction
265
+ */
266
+ reactions?: CommentReaction[];
267
+ /**
268
+ * 评论时间
269
+ */
270
+ timestamp?: string;
271
+ }
272
+
273
+ /**
274
+ * 给渲染层使用的评论
275
+ */
276
+ export interface IThreadComment extends IComment {
277
+ /**
278
+ * 添加一个评论会生成一个 id
279
+ */
280
+ id: string;
281
+ }
282
+
283
+ export interface CommentsPanelOptions {
284
+ /**
285
+ * panel icon class name
286
+ */
287
+ iconClass?: string;
288
+ priority?: number;
289
+ /**
290
+ * panel title
291
+ */
292
+ title?: string;
293
+ /**
294
+ * is hidden
295
+ */
296
+ hidden?: boolean;
297
+ badge?: string;
298
+ /**
299
+ * title component
300
+ */
301
+ titleComponent?: React.ComponentType<any>;
302
+ initialProps?: object;
303
+ /**
304
+ * header component
305
+ */
306
+ header?: {
307
+ component: React.ReactNode;
308
+ height: number;
309
+ };
310
+ /**
311
+ * 无内容显示的文案
312
+ */
313
+ defaultPlaceholder?: React.ReactNode | string;
314
+ /**
315
+ * 是否默认显示 底部 panel
316
+ */
317
+ defaultShow?: boolean;
318
+ }
319
+
320
+ export type PanelTreeNodeHandler = (nodes: IWriteableCommentsTreeNode[]) => ICommentsTreeNode[];
321
+
322
+ export type FileUploadHandler = (text: string | IMarkdownString, files: FileList) => MaybePromise<string>;
323
+
324
+ export type ZoneWidgerRender = (thread: ICommentsThread, widget: ICommentsZoneWidget) => React.ReactNode;
325
+
326
+ export interface MentionsData {
327
+ id: string;
328
+ display: string;
329
+ [key: string]: any;
330
+ }
331
+
332
+ export interface MentionsOptions {
333
+ /**
334
+ * 最终选择后在输入框里显示的样子
335
+ * 默认为 @${display}
336
+ */
337
+ displayTransform?: (id: string, display: string) => string;
338
+ /**
339
+ * 在搜索时返回数据
340
+ */
341
+ providerData?: (query: string) => MaybePromise<MentionsData[]>;
342
+ /**
343
+ * 渲染每一个搜索选项的函数
344
+ * 默认为 <div>${display}</div>
345
+ */
346
+ renderSuggestion?: (data: MentionsData, search: string, highlightedDisplay: string) => React.ReactNode;
347
+ /**
348
+ * 用于预览时的模板
349
+ * 默认为 '@[__display__](__id__)'
350
+ */
351
+ markup?: string;
352
+ }
353
+
354
+ export interface ICommentProviderFeature {
355
+ /**
356
+ * 设置在评论区输入框的配置
357
+ */
358
+ placeholder?: string;
359
+ }
360
+
361
+ export interface ICommentsConfig {
362
+ /**
363
+ * 是否支持单行多个评论
364
+ * 默认为 false
365
+ */
366
+ isMultiCommentsForSingleLine?: boolean;
367
+ /**
368
+ * 当前用户信息,用于第一次创建时面板左侧的显示的用户头像
369
+ */
370
+ author?: {
371
+ avatar: string;
372
+ };
373
+ /**
374
+ * 设置在编辑器里是否展示特定评论的过滤函数
375
+ */
376
+ filterThreadDecoration?: (thread: ICommentsThread) => boolean;
377
+ }
378
+
379
+ export const ICommentsFeatureRegistry = Symbol('ICommentsFeatureRegistry');
380
+ export interface ICommentsFeatureRegistry {
381
+ /**
382
+ * 注册基础信息
383
+ */
384
+ registerConfig(config: ICommentsConfig): void;
385
+ /**
386
+ * 注册在评论面板里文件上传的处理函数
387
+ * @param handler
388
+ */
389
+ registerFileUploadHandler(handler: FileUploadHandler): void;
390
+ /**
391
+ * 注册底部面板的参数,可以覆盖底部面板的默认参数
392
+ * @param options
393
+ */
394
+ registerPanelOptions(options: CommentsPanelOptions): void;
395
+ /**
396
+ * 注册底部面板评论树的处理函数,可以在渲染前重新再定义一次树的数据结构
397
+ * @param handler
398
+ */
399
+ registerPanelTreeNodeHandler(handler: PanelTreeNodeHandler): void;
400
+ /**
401
+ * 注册提及相关功能的能力
402
+ * @param options
403
+ */
404
+ registerMentionsOptions(options: MentionsOptions): void;
405
+
406
+ /**
407
+ * 注册 WidgetView
408
+ * @param render
409
+ */
410
+ registerZoneWidgetRender(render: ZoneWidgerRender): void;
411
+
412
+ /**
413
+ * 注册 Provider Feature
414
+ * @param provider id
415
+ * @param feature
416
+ */
417
+ registerProviderFeature(providerId: string, feature: ICommentProviderFeature): void;
418
+ /**
419
+ * 获取底部面板参数
420
+ */
421
+ getCommentsPanelOptions(): CommentsPanelOptions;
422
+ /**
423
+ * 获取底部面板评论树的处理函数
424
+ */
425
+ getCommentsPanelTreeNodeHandlers(): PanelTreeNodeHandler[];
426
+ /**
427
+ * 获取底部面板评论树的处理函数
428
+ */
429
+ getCommentsPanelTreeNodeHandlers(): PanelTreeNodeHandler[];
430
+ /**
431
+ * 获取文件上传处理函数
432
+ */
433
+ getFileUploadHandler(): FileUploadHandler | undefined;
434
+ /**
435
+ * 获取提及相关参数
436
+ */
437
+ getMentionsOptions(): MentionsOptions;
438
+
439
+ /**
440
+ * 获取指定的 zone widget
441
+ */
442
+ getZoneWidgetRender(): ZoneWidgerRender | undefined;
443
+ /**
444
+ * 获取基础配置
445
+ */
446
+ getConfig(): ICommentsConfig;
447
+
448
+ /**
449
+ * 获取 provider feature
450
+ * */
451
+ getProviderFeature(providerId: string): ICommentProviderFeature | undefined;
452
+ }
453
+
454
+ export const CommentsContribution = Symbol('CommentsContribution');
455
+ export interface CommentsContribution {
456
+ /**
457
+ * 提供可评论的 range
458
+ * @param editor 当前 editor 实例
459
+ */
460
+ provideCommentingRanges(documentModel: IEditorDocumentModel): MaybePromise<IRange[] | undefined>;
461
+ /**
462
+ * 扩展评论模块的能力
463
+ * @param registry
464
+ */
465
+ registerCommentsFeature?(registry: ICommentsFeatureRegistry): void;
466
+ }
467
+
468
+ /**
469
+ * 创建 comment thread
470
+ */
471
+ export interface ICommentsThread extends IDisposable {
472
+ /**
473
+ * thread id
474
+ */
475
+ id: string;
476
+ /**
477
+ * provider id
478
+ */
479
+ providerId: string;
480
+ /**
481
+ * 评论
482
+ */
483
+ comments: IThreadComment[];
484
+ /**
485
+ * 当前 thread 的 uri
486
+ */
487
+ uri: URI;
488
+ /**
489
+ * 当前 thread range
490
+ */
491
+ range: IRange;
492
+ /**
493
+ * 是否折叠,默认为 false
494
+ */
495
+ isCollapsed: boolean;
496
+ /**
497
+ * 附属数据
498
+ */
499
+ data?: any;
500
+ /**
501
+ * thread 维度的 contextValue
502
+ */
503
+ contextValue?: string;
504
+ /**
505
+ * 在 header 组件显示的文案
506
+ */
507
+ label?: string;
508
+ /**
509
+ * thread 参数
510
+ */
511
+ options: ICommentsThreadOptions;
512
+ /**
513
+ * thread 头部文案
514
+ */
515
+ threadHeaderTitle: string;
516
+ /**
517
+ * 是否是只读
518
+ */
519
+ readOnly: boolean;
520
+ /**
521
+ * 评论面板的 context key service
522
+ */
523
+ contextKeyService: IContextKeyService;
524
+ /**
525
+ * 添加评论
526
+ * @param comment
527
+ */
528
+ addComment(...comment: IComment[]): void;
529
+ /**
530
+ * 移除评论
531
+ * @param comment
532
+ */
533
+ removeComment(comment: IComment): void;
534
+ /**
535
+ * 显示 zone widget
536
+ * @param editor 指定在某一个 editor 中打开
537
+ */
538
+ show(editor?: IEditor): void;
539
+ /**
540
+ * 如果之前是显示的状态,则恢复显示
541
+ */
542
+ showWidgetsIfShowed(): void;
543
+ /**
544
+ * 临时隐藏 wiget,restoreShow 时恢复
545
+ */
546
+ hideWidgetsByDispose(): void;
547
+ /**
548
+ * 切换 zone widget
549
+ */
550
+ toggle(editor: IEditor): void;
551
+ /**
552
+ * 隐藏 zone widget
553
+ * @param editor 指定在某一个 editor 中隐藏
554
+ */
555
+ hide(editor?: IEditor): void;
556
+ /**
557
+ * 显示所有 zone widget
558
+ * @deprecated
559
+ */
560
+ showAll(): void;
561
+ /**
562
+ * 隐藏所有 widget
563
+ * @deprecated
564
+ * @param isDispose dispose widget,此时不修改内部 _isShow 变量
565
+ */
566
+ hideAll(isDispose?: boolean): void;
567
+ /**
568
+ * 判断当前 editor 是否有显示的 widget
569
+ * @param editor
570
+ */
571
+ isShowWidget(editor?: IEditor): boolean;
572
+ /**
573
+ * 判断是否是统一 uri,同一 range 的 thread
574
+ * @param thread
575
+ */
576
+ isEqual(thread: ICommentsThread): boolean;
577
+ /**
578
+ * 通过 editor 获取 zone widget
579
+ * @param editor
580
+ */
581
+ getWidgetByEditor(editor: IEditor): ICommentsZoneWidget | undefined;
582
+ /**
583
+ * dispise 时会执行
584
+ */
585
+ onDispose: Event<void>;
586
+ }
587
+
588
+ export interface ICommentsThreadOptions {
589
+ comments?: IComment[];
590
+ /**
591
+ * 在 header 上定义的文案
592
+ */
593
+ label?: string;
594
+ /**
595
+ * 是否是只读模式
596
+ */
597
+ readOnly?: boolean;
598
+ /**
599
+ * 初始化折叠状态,默认为展开
600
+ */
601
+ isCollapsed?: boolean;
602
+ /**
603
+ * thread container className
604
+ */
605
+ threadClassName?: string;
606
+ /**
607
+ * thread title className
608
+ */
609
+ threadHeadClassName?: string;
610
+ /**
611
+ * 附属数据
612
+ */
613
+ data?: any;
614
+ /**
615
+ * thread context value
616
+ */
617
+ contextValue?: string;
618
+ }
619
+
620
+ export const ICommentsService = Symbol('ICommentsService');
621
+ export interface ICommentsService extends ITree {
622
+ /**
623
+ * 评论节点
624
+ */
625
+ commentsThreads: ICommentsThread[];
626
+ /**
627
+ * 初始化函数
628
+ */
629
+ init(): void;
630
+ /**
631
+ * 编辑器创建后的处理函数
632
+ * @param editor 当前编辑器
633
+ */
634
+ handleOnCreateEditor(editor: IEditor): IDisposable;
635
+ /**
636
+ * 创建一个 thread
637
+ * @param uri 执行 uri,支持 file 和 git 协议
638
+ * @param range 创建 thread 的行数
639
+ * @param options 额外参数
640
+ */
641
+ createThread(uri: URI, range: IRange, options?: ICommentsThreadOptions): ICommentsThread;
642
+ /**
643
+ * 获取指定 uri 下所有的 threads
644
+ * 默认按照 range 升序排列
645
+ * @param uri
646
+ */
647
+ getThreadsByUri(uri: URI): ICommentsThread[];
648
+ /**
649
+ * threads 变化的事件
650
+ */
651
+ onThreadsChanged: Event<ICommentsThread>;
652
+ /**
653
+ * threads 创建的事件
654
+ */
655
+ onThreadsCreated: Event<ICommentsThread>;
656
+ /**
657
+ * thread 下评论更新
658
+ */
659
+ onThreadsCommentChange: Event<ICommentsThread>;
660
+ /**
661
+ * 注册插件底部面板
662
+ */
663
+ registerCommentPanel(): void;
664
+ /**
665
+ * 通知对应 thread 下评论内容更新
666
+ */
667
+ fireThreadCommentChange(thread: ICommentsThread): void;
668
+ /**
669
+ * 触发左侧 decoration 的渲染
670
+ */
671
+ forceUpdateDecoration(): void;
672
+ /**
673
+ * 外部注册可评论的行号提供者
674
+ */
675
+ registerCommentRangeProvider(id: string, provider: ICommentRangeProvider): IDisposable;
676
+ /**
677
+ * 获取当前行的 provider id
678
+ * @param line
679
+ */
680
+ getProviderIdsByLine(line: number): string[];
681
+ /**
682
+ * 获取指定 uri 可以评论的 range
683
+ * @param uri
684
+ */
685
+ getContributionRanges(uri: URI): Promise<IRange[]>;
686
+ /**
687
+ * 销毁所有的 thread
688
+ */
689
+ dispose(): void;
690
+ }
691
+
692
+ export const CollapseId = 'comments.panel.action.collapse';
693
+
694
+ export const CloseThreadId = 'comments.thread.action.close';
695
+
696
+ export const SwitchCommandReaction = 'comments.comment.action.switchCommand';
697
+
698
+ export class CommentPanelCollapse extends BasicEvent<void> {}
699
+
700
+ export interface ICommentRangeProvider {
701
+ getCommentingRanges(documentModel: IEditorDocumentModel): MaybePromise<IRange[] | undefined>;
702
+ }
703
+
704
+ export interface CommentReactionPayload {
705
+ thread: ICommentsThread;
706
+ comment: IThreadComment;
707
+ reaction: CommentReaction;
708
+ }
709
+
710
+ export class CommentReactionClick extends BasicEvent<CommentReactionPayload> {}
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './common';