@codingame/monaco-vscode-comments-service-override 25.1.2 → 26.0.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-comments-service-override",
3
- "version": "25.1.2",
3
+ "version": "26.0.1",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - comments service-override",
6
6
  "keywords": [],
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "25.1.2"
18
+ "@codingame/monaco-vscode-api": "26.0.1"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -17,7 +17,9 @@ let CommentMenus = class CommentMenus {
17
17
  return this.getMenu(MenuId.CommentEditorActions, contextKeyService);
18
18
  }
19
19
  getCommentThreadAdditionalActions(contextKeyService) {
20
- return this.getMenu(MenuId.CommentThreadAdditionalActions, contextKeyService, { emitEventsForSubmenuChanges: true });
20
+ return this.getMenu(MenuId.CommentThreadAdditionalActions, contextKeyService, {
21
+ emitEventsForSubmenuChanges: true
22
+ });
21
23
  }
22
24
  getCommentTitleActions(comment, contextKeyService) {
23
25
  return this.getMenu(MenuId.CommentTitle, contextKeyService);
@@ -26,19 +28,18 @@ let CommentMenus = class CommentMenus {
26
28
  return this.getMenu(MenuId.CommentActions, contextKeyService);
27
29
  }
28
30
  getCommentThreadTitleContextActions(contextKeyService) {
29
- return this.getActions(MenuId.CommentThreadTitleContext, contextKeyService, { shouldForwardArgs: true });
31
+ return this.getActions(MenuId.CommentThreadTitleContext, contextKeyService, {
32
+ shouldForwardArgs: true
33
+ });
30
34
  }
31
35
  getMenu(menuId, contextKeyService, options) {
32
36
  return this.menuService.createMenu(menuId, contextKeyService, options);
33
37
  }
34
38
  getActions(menuId, contextKeyService, options) {
35
- return ( this.menuService.getMenuActions(menuId, contextKeyService, options).map((value) => value[1])).flat();
36
- }
37
- dispose() {
39
+ return ( this.menuService.getMenuActions(menuId, contextKeyService, options).map(value => value[1])).flat();
38
40
  }
41
+ dispose() {}
39
42
  };
40
- CommentMenus = ( __decorate([
41
- ( __param(0, IMenuService))
42
- ], CommentMenus));
43
+ CommentMenus = ( __decorate([( __param(0, IMenuService))], CommentMenus));
43
44
 
44
45
  export { CommentMenus };
@@ -18,9 +18,17 @@ import { CommentsModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/
18
18
  import { IModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/model.service';
19
19
  import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
20
20
 
21
- const CONTINUE_ON_COMMENTS = 'comments.continueOnComments';
21
+ const CONTINUE_ON_COMMENTS = "comments.continueOnComments";
22
22
  let CommentService = class CommentService extends Disposable {
23
- constructor(instantiationService, layoutService, configurationService, contextKeyService, storageService, logService, modelService) {
23
+ constructor(
24
+ instantiationService,
25
+ layoutService,
26
+ configurationService,
27
+ contextKeyService,
28
+ storageService,
29
+ logService,
30
+ modelService
31
+ ) {
24
32
  super();
25
33
  this.instantiationService = instantiationService;
26
34
  this.layoutService = layoutService;
@@ -66,7 +74,11 @@ let CommentService = class CommentService extends Disposable {
66
74
  this._workspaceHasCommenting = CommentContextKeys.WorkspaceHasCommenting.bindTo(contextKeyService);
67
75
  this._commentingEnabled = CommentContextKeys.commentingEnabled.bindTo(contextKeyService);
68
76
  const storageListener = this._register(( new DisposableStore()));
69
- const storageEvent = Event.debounce(this.storageService.onDidChangeValue(StorageScope.WORKSPACE, CONTINUE_ON_COMMENTS, storageListener), (last, event) => last?.external ? last : event, 500);
77
+ const storageEvent = Event.debounce(
78
+ this.storageService.onDidChangeValue(StorageScope.WORKSPACE, CONTINUE_ON_COMMENTS, storageListener),
79
+ (last, event) => last?.external ? last : event,
80
+ 500
81
+ );
70
82
  storageListener.add(storageEvent(v => {
71
83
  if (!v.external) {
72
84
  return;
@@ -75,7 +87,7 @@ let CommentService = class CommentService extends Disposable {
75
87
  if (!commentsToRestore) {
76
88
  return;
77
89
  }
78
- this.logService.debug(`Comments: URIs of continue on comments from storage ${( commentsToRestore.map(thread => ( thread.uri.toString()))).join(', ')}.`);
90
+ this.logService.debug(`Comments: URIs of continue on comments from storage ${( commentsToRestore.map(thread => ( thread.uri.toString()))).join(", ")}.`);
79
91
  const changedOwners = this._addContinueOnComments(commentsToRestore, this._continueOnComments);
80
92
  for (const uniqueOwner of changedOwners) {
81
93
  const control = this._commentControls.get(uniqueOwner);
@@ -126,7 +138,7 @@ let CommentService = class CommentService extends Disposable {
126
138
  _handleConfiguration() {
127
139
  this._isCommentingEnabled = this._defaultCommentingEnablement;
128
140
  this._register(this.configurationService.onDidChangeConfiguration(e => {
129
- if (e.affectsConfiguration('comments.visible')) {
141
+ if (e.affectsConfiguration("comments.visible")) {
130
142
  this.enableCommenting(this._defaultCommentingEnablement);
131
143
  }
132
144
  }));
@@ -137,8 +149,7 @@ let CommentService = class CommentService extends Disposable {
137
149
  if (e) {
138
150
  preZenModeValue = this._isCommentingEnabled;
139
151
  this.enableCommenting(false);
140
- }
141
- else {
152
+ } else {
142
153
  this.enableCommenting(preZenModeValue);
143
154
  }
144
155
  }));
@@ -177,11 +188,18 @@ let CommentService = class CommentService extends Disposable {
177
188
  return commentController.setActiveCommentAndThread(commentInfo);
178
189
  }
179
190
  setDocumentComments(resource, commentInfos) {
180
- this._onDidSetResourceCommentInfos.fire({ resource, commentInfos });
191
+ this._onDidSetResourceCommentInfos.fire({
192
+ resource,
193
+ commentInfos
194
+ });
181
195
  }
182
196
  setModelThreads(ownerId, owner, ownerLabel, commentThreads) {
183
197
  this._commentsModel.setCommentThreads(ownerId, owner, ownerLabel, commentThreads);
184
- this._onDidSetAllCommentThreads.fire({ ownerId, ownerLabel, commentThreads });
198
+ this._onDidSetAllCommentThreads.fire({
199
+ ownerId,
200
+ ownerLabel,
201
+ commentThreads
202
+ });
185
203
  }
186
204
  updateModelThreads(event) {
187
205
  this._commentsModel.updateCommentThreads(event);
@@ -209,8 +227,7 @@ let CommentService = class CommentService extends Disposable {
209
227
  unregisterCommentController(uniqueOwner) {
210
228
  if (uniqueOwner) {
211
229
  this._commentControls.delete(uniqueOwner);
212
- }
213
- else {
230
+ } else {
214
231
  this._commentControls.clear();
215
232
  }
216
233
  this._commentsModel.deleteCommentsByOwner(uniqueOwner);
@@ -248,12 +265,18 @@ let CommentService = class CommentService extends Disposable {
248
265
  updateComments(ownerId, event) {
249
266
  const control = this._commentControls.get(ownerId);
250
267
  if (control) {
251
- const evt = Object.assign({}, event, { uniqueOwner: ownerId, ownerLabel: control.label, owner: control.owner });
268
+ const evt = Object.assign({}, event, {
269
+ uniqueOwner: ownerId,
270
+ ownerLabel: control.label,
271
+ owner: control.owner
272
+ });
252
273
  this.updateModelThreads(evt);
253
274
  }
254
275
  }
255
276
  updateNotebookComments(ownerId, event) {
256
- const evt = Object.assign({}, event, { uniqueOwner: ownerId });
277
+ const evt = Object.assign({}, event, {
278
+ uniqueOwner: ownerId
279
+ });
257
280
  this._onDidUpdateNotebookCommentThreads.fire(evt);
258
281
  }
259
282
  updateCommentingRanges(ownerId, resourceHints) {
@@ -263,15 +286,16 @@ let CommentService = class CommentService extends Disposable {
263
286
  }
264
287
  }
265
288
  this._workspaceHasCommenting.set(true);
266
- this._onDidUpdateCommentingRanges.fire({ uniqueOwner: ownerId });
289
+ this._onDidUpdateCommentingRanges.fire({
290
+ uniqueOwner: ownerId
291
+ });
267
292
  }
268
293
  async toggleReaction(uniqueOwner, resource, thread, comment, reaction) {
269
294
  const commentController = this._commentControls.get(uniqueOwner);
270
295
  if (commentController) {
271
296
  return commentController.toggleReaction(resource, thread, comment, reaction, CancellationToken.None);
272
- }
273
- else {
274
- throw ( new Error('Not supported'));
297
+ } else {
298
+ throw ( new Error("Not supported"));
275
299
  }
276
300
  }
277
301
  hasReactionHandler(uniqueOwner) {
@@ -284,20 +308,24 @@ let CommentService = class CommentService extends Disposable {
284
308
  async getDocumentComments(resource) {
285
309
  const commentControlResult = [];
286
310
  for (const control of ( this._commentControls.values())) {
287
- commentControlResult.push(control.getDocumentComments(resource, CancellationToken.None)
288
- .then(documentComments => {
289
- for (const documentCommentThread of documentComments.threads) {
290
- if (documentCommentThread.comments?.length === 0 && documentCommentThread.range) {
291
- this.removeContinueOnComment({ range: documentCommentThread.range, uri: resource, uniqueOwner: documentComments.uniqueOwner });
311
+ commentControlResult.push(
312
+ control.getDocumentComments(resource, CancellationToken.None).then(documentComments => {
313
+ for (const documentCommentThread of documentComments.threads) {
314
+ if (documentCommentThread.comments?.length === 0 && documentCommentThread.range) {
315
+ this.removeContinueOnComment({
316
+ range: documentCommentThread.range,
317
+ uri: resource,
318
+ uniqueOwner: documentComments.uniqueOwner
319
+ });
320
+ }
292
321
  }
293
- }
294
- const pendingComments = this._continueOnComments.get(documentComments.uniqueOwner);
295
- documentComments.pendingCommentThreads = pendingComments?.filter(pendingComment => ( pendingComment.uri.toString()) === ( resource.toString()));
296
- return documentComments;
297
- })
298
- .catch(_ => {
299
- return null;
300
- }));
322
+ const pendingComments = this._continueOnComments.get(documentComments.uniqueOwner);
323
+ documentComments.pendingCommentThreads = pendingComments?.filter(pendingComment => ( pendingComment.uri.toString()) === ( resource.toString()));
324
+ return documentComments;
325
+ }).catch(_ => {
326
+ return null;
327
+ })
328
+ );
301
329
  }
302
330
  const commentInfos = await Promise.all(commentControlResult);
303
331
  this._updateResourcesWithCommentingRanges(resource, commentInfos);
@@ -306,8 +334,7 @@ let CommentService = class CommentService extends Disposable {
306
334
  async getNotebookComments(resource) {
307
335
  const commentControlResult = [];
308
336
  this._commentControls.forEach(control => {
309
- commentControlResult.push(control.getNotebookComments(resource, CancellationToken.None)
310
- .catch(_ => {
337
+ commentControlResult.push(control.getNotebookComments(resource, CancellationToken.None).catch(_ => {
311
338
  return null;
312
339
  }));
313
340
  });
@@ -326,8 +353,13 @@ let CommentService = class CommentService extends Disposable {
326
353
  for (const pendingComments of ( map.values())) {
327
354
  commentsToSave.push(...pendingComments);
328
355
  }
329
- this.logService.debug(`Comments: URIs of continue on comments to add to storage ${( commentsToSave.map(thread => ( thread.uri.toString()))).join(', ')}.`);
330
- this.storageService.store(CONTINUE_ON_COMMENTS, commentsToSave, StorageScope.WORKSPACE, StorageTarget.USER);
356
+ this.logService.debug(`Comments: URIs of continue on comments to add to storage ${( commentsToSave.map(thread => ( thread.uri.toString()))).join(", ")}.`);
357
+ this.storageService.store(
358
+ CONTINUE_ON_COMMENTS,
359
+ commentsToSave,
360
+ StorageScope.WORKSPACE,
361
+ StorageTarget.USER
362
+ );
331
363
  }
332
364
  removeContinueOnComment(pendingComment) {
333
365
  const pendingComments = this._continueOnComments.get(pendingComment.uniqueOwner);
@@ -345,8 +377,7 @@ let CommentService = class CommentService extends Disposable {
345
377
  if (!( map.has(pendingComment.uniqueOwner))) {
346
378
  map.set(pendingComment.uniqueOwner, [pendingComment]);
347
379
  changedOwners.add(pendingComment.uniqueOwner);
348
- }
349
- else {
380
+ } else {
350
381
  const commentsForOwner = map.get(pendingComment.uniqueOwner);
351
382
  if (commentsForOwner.every(comment => (( comment.uri.toString()) !== ( pendingComment.uri.toString())) || !Range.equalsRange(comment.range, pendingComment.range))) {
352
383
  commentsForOwner.push(pendingComment);
@@ -360,14 +391,6 @@ let CommentService = class CommentService extends Disposable {
360
391
  return ( this._commentingRangeResourceHintSchemes.has(resource.scheme)) || ( this._commentingRangeResources.has(( resource.toString())));
361
392
  }
362
393
  };
363
- CommentService = ( __decorate([
364
- ( __param(0, IInstantiationService)),
365
- ( __param(1, IWorkbenchLayoutService)),
366
- ( __param(2, IConfigurationService)),
367
- ( __param(3, IContextKeyService)),
368
- ( __param(4, IStorageService)),
369
- ( __param(5, ILogService)),
370
- ( __param(6, IModelService))
371
- ], CommentService));
394
+ CommentService = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IWorkbenchLayoutService)), ( __param(2, IConfigurationService)), ( __param(3, IContextKeyService)), ( __param(4, IStorageService)), ( __param(5, ILogService)), ( __param(6, IModelService))], CommentService));
372
395
 
373
396
  export { CommentService };
@@ -32,14 +32,14 @@ registerAction2(class Collapse extends ViewAction {
32
32
  constructor() {
33
33
  super({
34
34
  viewId: COMMENTS_VIEW_ID,
35
- id: 'comments.collapse',
36
- title: ( localize(6319, "Collapse All")),
35
+ id: "comments.collapse",
36
+ title: ( localize(6628, "Collapse All")),
37
37
  f1: false,
38
38
  icon: Codicon.collapseAll,
39
39
  menu: {
40
40
  id: MenuId.ViewTitle,
41
- group: 'navigation',
42
- when: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ContextKeyExpr.equals('view', COMMENTS_VIEW_ID)), CONTEXT_KEY_HAS_COMMENTS)), CONTEXT_KEY_SOME_COMMENTS_EXPANDED)),
41
+ group: "navigation",
42
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ContextKeyExpr.equals("view", COMMENTS_VIEW_ID)), CONTEXT_KEY_HAS_COMMENTS)), CONTEXT_KEY_SOME_COMMENTS_EXPANDED)),
43
43
  order: 100
44
44
  }
45
45
  });
@@ -52,14 +52,14 @@ registerAction2(class Expand extends ViewAction {
52
52
  constructor() {
53
53
  super({
54
54
  viewId: COMMENTS_VIEW_ID,
55
- id: 'comments.expand',
56
- title: ( localize(6320, "Expand All")),
55
+ id: "comments.expand",
56
+ title: ( localize(6629, "Expand All")),
57
57
  f1: false,
58
58
  icon: Codicon.expandAll,
59
59
  menu: {
60
60
  id: MenuId.ViewTitle,
61
- group: 'navigation',
62
- when: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ContextKeyExpr.equals('view', COMMENTS_VIEW_ID)), CONTEXT_KEY_HAS_COMMENTS)), ContextKeyExpr.not(CONTEXT_KEY_SOME_COMMENTS_EXPANDED.key))),
61
+ group: "navigation",
62
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.and(( ContextKeyExpr.equals("view", COMMENTS_VIEW_ID)), CONTEXT_KEY_HAS_COMMENTS)), ContextKeyExpr.not(CONTEXT_KEY_SOME_COMMENTS_EXPANDED.key))),
63
63
  order: 100
64
64
  }
65
65
  });
@@ -71,92 +71,98 @@ registerAction2(class Expand extends ViewAction {
71
71
  registerAction2(class Reply extends Action2 {
72
72
  constructor() {
73
73
  super({
74
- id: 'comments.reply',
75
- title: ( localize(6321, "Reply")),
74
+ id: "comments.reply",
75
+ title: ( localize(6630, "Reply")),
76
76
  icon: Codicon.reply,
77
- precondition: ( ContextKeyExpr.equals('canReply', true)),
77
+ precondition: ( ContextKeyExpr.equals("canReply", true)),
78
78
  menu: [{
79
- id: MenuId.CommentsViewThreadActions,
80
- order: 100
81
- },
82
- {
83
- id: MenuId.AccessibleView,
84
- when: ( ContextKeyExpr.and(accessibleViewIsShown, ( ContextKeyExpr.equals(accessibleViewCurrentProviderId.key, AccessibleViewProviderId.Comments)))),
85
- }]
79
+ id: MenuId.CommentsViewThreadActions,
80
+ order: 100
81
+ }, {
82
+ id: MenuId.AccessibleView,
83
+ when: ( ContextKeyExpr.and(accessibleViewIsShown, ( ContextKeyExpr.equals(accessibleViewCurrentProviderId.key, AccessibleViewProviderId.Comments))))
84
+ }]
86
85
  });
87
86
  }
88
87
  run(accessor, marshalledCommentThread) {
89
88
  const commentService = accessor.get(ICommentService);
90
89
  const editorService = accessor.get(IEditorService);
91
90
  const uriIdentityService = accessor.get(IUriIdentityService);
92
- revealCommentThread(commentService, editorService, uriIdentityService, marshalledCommentThread.thread, marshalledCommentThread.thread.comments[marshalledCommentThread.thread.comments.length - 1], true);
91
+ revealCommentThread(
92
+ commentService,
93
+ editorService,
94
+ uriIdentityService,
95
+ marshalledCommentThread.thread,
96
+ marshalledCommentThread.thread.comments[marshalledCommentThread.thread.comments.length - 1],
97
+ true
98
+ );
93
99
  }
94
100
  });
95
101
  ( Registry.as(Extensions.Configuration)).registerConfiguration({
96
- id: 'comments',
102
+ id: "comments",
97
103
  order: 20,
98
- title: ( localize(6322, "Comments")),
99
- type: 'object',
104
+ title: ( localize(6631, "Comments")),
105
+ type: "object",
100
106
  properties: {
101
- 'comments.openPanel': {
102
- enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'],
103
- default: 'openOnSessionStartWithComments',
104
- description: ( localize(6323, "Controls when the comments panel should open.")),
107
+ "comments.openPanel": {
108
+ enum: ["neverOpen", "openOnSessionStart", "openOnSessionStartWithComments"],
109
+ default: "openOnSessionStartWithComments",
110
+ description: ( localize(6632, "Controls when the comments panel should open.")),
105
111
  restricted: false,
106
- markdownDeprecationMessage: ( localize(6324, "This setting is deprecated in favor of `comments.openView`."))
112
+ markdownDeprecationMessage: ( localize(6633, "This setting is deprecated in favor of `comments.openView`."))
107
113
  },
108
- 'comments.openView': {
109
- enum: ['never', 'file', 'firstFile', 'firstFileUnresolved'],
110
- enumDescriptions: [( localize(6325, "The comments view will never be opened.")), ( localize(6326, "The comments view will open when a file with comments is active.")), ( localize(
111
- 6327,
114
+ "comments.openView": {
115
+ enum: ["never", "file", "firstFile", "firstFileUnresolved"],
116
+ enumDescriptions: [( localize(6634, "The comments view will never be opened.")), ( localize(6635, "The comments view will open when a file with comments is active.")), ( localize(
117
+ 6636,
112
118
  "If the comments view has not been opened yet during this session it will open the first time during a session that a file with comments is active."
113
119
  )), ( localize(
114
- 6328,
120
+ 6637,
115
121
  "If the comments view has not been opened yet during this session and the comment is not resolved, it will open the first time during a session that a file with comments is active."
116
122
  ))],
117
- default: 'firstFile',
118
- description: ( localize(6329, "Controls when the comments view should open.")),
123
+ default: "firstFile",
124
+ description: ( localize(6638, "Controls when the comments view should open.")),
119
125
  restricted: false
120
126
  },
121
- 'comments.useRelativeTime': {
122
- type: 'boolean',
127
+ "comments.useRelativeTime": {
128
+ type: "boolean",
123
129
  default: true,
124
130
  description: ( localize(
125
- 6330,
131
+ 6639,
126
132
  "Determines if relative time will be used in comment timestamps (ex. '1 day ago')."
127
133
  ))
128
134
  },
129
- 'comments.visible': {
130
- type: 'boolean',
135
+ "comments.visible": {
136
+ type: "boolean",
131
137
  default: true,
132
138
  description: ( localize(
133
- 6331,
139
+ 6640,
134
140
  "Controls the visibility of the comments bar and comment threads in editors that have commenting ranges and comments. Comments are still accessible via the Comments view and will cause commenting to be toggled on in the same way running the command \"Comments: Toggle Editor Commenting\" toggles comments."
135
141
  ))
136
142
  },
137
- 'comments.maxHeight': {
138
- type: 'boolean',
143
+ "comments.maxHeight": {
144
+ type: "boolean",
139
145
  default: true,
140
- description: ( localize(6332, "Controls whether the comments widget scrolls or expands."))
146
+ description: ( localize(6641, "Controls whether the comments widget scrolls or expands."))
141
147
  },
142
- 'comments.collapseOnResolve': {
143
- type: 'boolean',
148
+ "comments.collapseOnResolve": {
149
+ type: "boolean",
144
150
  default: true,
145
151
  description: ( localize(
146
- 6333,
152
+ 6642,
147
153
  "Controls whether the comment thread should collapse when the thread is resolved."
148
154
  ))
149
155
  },
150
- 'comments.thread.confirmOnCollapse': {
151
- type: 'string',
152
- enum: ['whenHasUnsubmittedComments', 'never'],
156
+ "comments.thread.confirmOnCollapse": {
157
+ type: "string",
158
+ enum: ["whenHasUnsubmittedComments", "never"],
153
159
  enumDescriptions: [( localize(
154
- 6334,
160
+ 6643,
155
161
  "Show a confirmation dialog when collapsing a comment thread with unsubmitted comments."
156
- )), ( localize(6335, "Never show a confirmation dialog when collapsing a comment thread."))],
157
- default: 'whenHasUnsubmittedComments',
162
+ )), ( localize(6644, "Never show a confirmation dialog when collapsing a comment thread."))],
163
+ default: "whenHasUnsubmittedComments",
158
164
  description: ( localize(
159
- 6336,
165
+ 6645,
160
166
  "Controls whether a confirmation dialog is shown when collapsing a comment thread."
161
167
  ))
162
168
  }
@@ -169,8 +175,12 @@ let UnresolvedCommentsBadge = class UnresolvedCommentsBadge extends Disposable {
169
175
  this.activityService = activityService;
170
176
  this.activity = this._register(( new MutableDisposable()));
171
177
  this.totalUnresolved = 0;
172
- this._register(this._commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged, this));
173
- this._register(this._commentService.onDidUpdateCommentThreads(this.onCommentsUpdated, this));
178
+ this._register(
179
+ this._commentService.onDidSetAllCommentThreads(this.onAllCommentsChanged, this)
180
+ );
181
+ this._register(
182
+ this._commentService.onDidUpdateCommentThreads(this.onCommentsUpdated, this)
183
+ );
174
184
  this._register(this._commentService.onDidDeleteDataProvider(this.onCommentsUpdated, this));
175
185
  }
176
186
  onAllCommentsChanged(e) {
@@ -198,14 +208,13 @@ let UnresolvedCommentsBadge = class UnresolvedCommentsBadge extends Disposable {
198
208
  return;
199
209
  }
200
210
  this.totalUnresolved = unresolved;
201
- const message = ( localize(6337, '{0} Unresolved Comments', this.totalUnresolved));
202
- this.activity.value = this.activityService.showViewActivity(COMMENTS_VIEW_ID, { badge: ( new NumberBadge(this.totalUnresolved, () => message)) });
211
+ const message = ( localize(6646, "{0} Unresolved Comments", this.totalUnresolved));
212
+ this.activity.value = this.activityService.showViewActivity(COMMENTS_VIEW_ID, {
213
+ badge: ( new NumberBadge(this.totalUnresolved, () => message))
214
+ });
203
215
  }
204
216
  };
205
- UnresolvedCommentsBadge = ( __decorate([
206
- ( __param(0, ICommentService)),
207
- ( __param(1, IActivityService))
208
- ], UnresolvedCommentsBadge));
217
+ UnresolvedCommentsBadge = ( __decorate([( __param(0, ICommentService)), ( __param(1, IActivityService))], UnresolvedCommentsBadge));
209
218
  ( Registry.as(Extensions$1.Workbench)).registerWorkbenchContribution(UnresolvedCommentsBadge, LifecyclePhase.Eventually);
210
219
  AccessibleViewRegistry.register(( new CommentsAccessibleView()));
211
220
  AccessibleViewRegistry.register(( new CommentThreadAccessibleView()));
@@ -34,7 +34,7 @@ class CommentsAccessibleView extends Disposable {
34
34
  constructor() {
35
35
  super();
36
36
  this.priority = 90;
37
- this.name = 'comment';
37
+ this.name = "comment";
38
38
  this.when = CONTEXT_KEY_COMMENT_FOCUSED;
39
39
  this.type = AccessibleViewType.View;
40
40
  }
@@ -53,7 +53,7 @@ class CommentThreadAccessibleView extends Disposable {
53
53
  constructor() {
54
54
  super();
55
55
  this.priority = 85;
56
- this.name = 'commentThread';
56
+ this.name = "commentThread";
57
57
  this.when = CommentContextKeys.commentFocused;
58
58
  this.type = AccessibleViewType.View;
59
59
  }
@@ -66,7 +66,9 @@ class CommentsAccessibleContentProvider extends Disposable {
66
66
  this._menus = _menus;
67
67
  this.id = AccessibleViewProviderId.Comments;
68
68
  this.verbositySettingKey = AccessibilityVerbositySettingId.Comments;
69
- this.options = { type: AccessibleViewType.View };
69
+ this.options = {
70
+ type: AccessibleViewType.View
71
+ };
70
72
  this.actions = ( [...this._menus.getResourceContextActions(this._focusedCommentNode)].filter(i => i.enabled).map(action => {
71
73
  return {
72
74
  ...action,
@@ -76,7 +78,7 @@ class CommentsAccessibleContentProvider extends Disposable {
76
78
  thread: this._focusedCommentNode.thread,
77
79
  $mid: MarshalledId.CommentThread,
78
80
  commentControlHandle: this._focusedCommentNode.controllerHandle,
79
- commentThreadHandle: this._focusedCommentNode.threadHandle,
81
+ commentThreadHandle: this._focusedCommentNode.threadHandle
80
82
  });
81
83
  }
82
84
  };
@@ -86,7 +88,7 @@ class CommentsAccessibleContentProvider extends Disposable {
86
88
  const commentNode = this._commentsView.focusedCommentNode;
87
89
  const content = this._commentsView.focusedCommentInfo?.toString();
88
90
  if (!commentNode || !content) {
89
- throw ( new Error('Comment tree is focused but no comment is selected'));
91
+ throw ( new Error("Comment tree is focused but no comment is selected"));
90
92
  }
91
93
  return content;
92
94
  }
@@ -110,7 +112,9 @@ let CommentsThreadWidgetAccessibleContentProvider = class CommentsThreadWidgetAc
110
112
  this._uriIdentityService = _uriIdentityService;
111
113
  this.id = AccessibleViewProviderId.CommentThread;
112
114
  this.verbositySettingKey = AccessibilityVerbositySettingId.Comments;
113
- this.options = { type: AccessibleViewType.View };
115
+ this.options = {
116
+ type: AccessibleViewType.View
117
+ };
114
118
  }
115
119
  get activeCommentInfo() {
116
120
  if (!this._activeCommentInfo && this._commentService.lastActiveCommentcontroller) {
@@ -120,20 +124,20 @@ let CommentsThreadWidgetAccessibleContentProvider = class CommentsThreadWidgetAc
120
124
  }
121
125
  provideContent() {
122
126
  if (!this.activeCommentInfo) {
123
- throw ( new Error('No current comment thread'));
127
+ throw ( new Error("No current comment thread"));
124
128
  }
125
129
  const comment = this.activeCommentInfo.comment?.body;
126
- const commentLabel = typeof comment === 'string' ? comment : comment?.value ?? '';
130
+ const commentLabel = typeof comment === "string" ? comment : comment?.value ?? "";
127
131
  const resource = this.activeCommentInfo.thread.resource;
128
132
  const range = this.activeCommentInfo.thread.range;
129
- let contentLabel = '';
133
+ let contentLabel = "";
130
134
  if (resource && range) {
131
135
  const editor = this._editorService.findEditors(( URI.parse(resource))) || [];
132
136
  const codeEditor = this._editorService.activeEditorPane?.getControl();
133
137
  if (editor?.length && isCodeEditor(codeEditor)) {
134
138
  const content = codeEditor.getModel()?.getValueInRange(range);
135
139
  if (content) {
136
- contentLabel = '\nCorresponding code: \n' + content;
140
+ contentLabel = "\nCorresponding code: \n" + content;
137
141
  }
138
142
  }
139
143
  }
@@ -143,11 +147,17 @@ let CommentsThreadWidgetAccessibleContentProvider = class CommentsThreadWidgetAc
143
147
  const lastComment = this._activeCommentInfo;
144
148
  this._activeCommentInfo = undefined;
145
149
  if (lastComment) {
146
- revealCommentThread(this._commentService, this._editorService, this._uriIdentityService, lastComment.thread, lastComment.comment);
150
+ revealCommentThread(
151
+ this._commentService,
152
+ this._editorService,
153
+ this._uriIdentityService,
154
+ lastComment.thread,
155
+ lastComment.comment
156
+ );
147
157
  }
148
158
  }
149
159
  provideNextContent() {
150
- const newCommentInfo = moveToNextCommentInThread(this._activeCommentInfo, 'next');
160
+ const newCommentInfo = moveToNextCommentInThread(this._activeCommentInfo, "next");
151
161
  if (newCommentInfo) {
152
162
  this._activeCommentInfo = newCommentInfo;
153
163
  return this.provideContent();
@@ -155,7 +165,7 @@ let CommentsThreadWidgetAccessibleContentProvider = class CommentsThreadWidgetAc
155
165
  return undefined;
156
166
  }
157
167
  providePreviousContent() {
158
- const newCommentInfo = moveToNextCommentInThread(this._activeCommentInfo, 'previous');
168
+ const newCommentInfo = moveToNextCommentInThread(this._activeCommentInfo, "previous");
159
169
  if (newCommentInfo) {
160
170
  this._activeCommentInfo = newCommentInfo;
161
171
  return this.provideContent();
@@ -163,10 +173,6 @@ let CommentsThreadWidgetAccessibleContentProvider = class CommentsThreadWidgetAc
163
173
  return undefined;
164
174
  }
165
175
  };
166
- CommentsThreadWidgetAccessibleContentProvider = ( __decorate([
167
- ( __param(0, ICommentService)),
168
- ( __param(1, IEditorService)),
169
- ( __param(2, IUriIdentityService))
170
- ], CommentsThreadWidgetAccessibleContentProvider));
176
+ CommentsThreadWidgetAccessibleContentProvider = ( __decorate([( __param(0, ICommentService)), ( __param(1, IEditorService)), ( __param(2, IUriIdentityService))], CommentsThreadWidgetAccessibleContentProvider));
171
177
 
172
178
  export { CommentThreadAccessibleView, CommentsAccessibleView };
@@ -29,7 +29,11 @@ import { CommentThreadCollapsibleState, CommentThreadState } from '@codingame/mo
29
29
 
30
30
  registerCss(review);
31
31
  registerEditorContribution(ID, CommentController, EditorContributionInstantiation.AfterFirstRender);
32
- registerWorkbenchContribution2(CommentsInputContentProvider.ID, CommentsInputContentProvider, WorkbenchPhase.BlockRestore);
32
+ registerWorkbenchContribution2(
33
+ CommentsInputContentProvider.ID,
34
+ CommentsInputContentProvider,
35
+ WorkbenchPhase.BlockRestore
36
+ );
33
37
  KeybindingsRegistry.registerCommandAndKeybindingRule({
34
38
  id: CommentCommandId.NextThread,
35
39
  handler: async (accessor, args) => {
@@ -44,7 +48,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
44
48
  controller.nextCommentThread(true);
45
49
  },
46
50
  weight: KeybindingWeight.EditorContrib,
47
- primary: KeyMod.Alt | KeyCode.F9,
51
+ primary: KeyMod.Alt | KeyCode.F9
48
52
  });
49
53
  KeybindingsRegistry.registerCommandAndKeybindingRule({
50
54
  id: CommentCommandId.PreviousThread,
@@ -67,17 +71,17 @@ registerAction2(class extends Action2 {
67
71
  super({
68
72
  id: CommentCommandId.NextCommentedRange,
69
73
  title: {
70
- value: ( localize(6358, "Go to Next Commented Range")),
71
- original: 'Go to Next Commented Range'
74
+ value: ( localize(6667, "Go to Next Commented Range")),
75
+ original: "Go to Next Commented Range"
72
76
  },
73
77
  category: {
74
- value: ( localize(6359, "Comments")),
75
- original: 'Comments'
78
+ value: ( localize(6668, "Comments")),
79
+ original: "Comments"
76
80
  },
77
81
  menu: [{
78
- id: MenuId.CommandPalette,
79
- when: CommentContextKeys.activeEditorHasCommentingRange
80
- }],
82
+ id: MenuId.CommandPalette,
83
+ when: CommentContextKeys.activeEditorHasCommentingRange
84
+ }],
81
85
  keybinding: {
82
86
  primary: KeyMod.Alt | KeyCode.F10,
83
87
  weight: KeybindingWeight.EditorContrib,
@@ -102,17 +106,17 @@ registerAction2(class extends Action2 {
102
106
  super({
103
107
  id: CommentCommandId.PreviousCommentedRange,
104
108
  title: {
105
- value: ( localize(6360, "Go to Previous Commented Range")),
106
- original: 'Go to Previous Commented Range'
109
+ value: ( localize(6669, "Go to Previous Commented Range")),
110
+ original: "Go to Previous Commented Range"
107
111
  },
108
112
  category: {
109
- value: ( localize(6359, "Comments")),
110
- original: 'Comments'
113
+ value: ( localize(6668, "Comments")),
114
+ original: "Comments"
111
115
  },
112
116
  menu: [{
113
- id: MenuId.CommandPalette,
114
- when: CommentContextKeys.activeEditorHasCommentingRange
115
- }],
117
+ id: MenuId.CommandPalette,
118
+ when: CommentContextKeys.activeEditorHasCommentingRange
119
+ }],
116
120
  keybinding: {
117
121
  primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F10,
118
122
  weight: KeybindingWeight.EditorContrib,
@@ -137,19 +141,22 @@ registerAction2(class extends Action2 {
137
141
  super({
138
142
  id: CommentCommandId.NextRange,
139
143
  title: {
140
- value: ( localize(6361, "Go to Next Commenting Range")),
141
- original: 'Go to Next Commenting Range'
144
+ value: ( localize(6670, "Go to Next Commenting Range")),
145
+ original: "Go to Next Commenting Range"
142
146
  },
143
147
  category: {
144
- value: ( localize(6359, "Comments")),
145
- original: 'Comments'
148
+ value: ( localize(6668, "Comments")),
149
+ original: "Comments"
146
150
  },
147
151
  menu: [{
148
- id: MenuId.CommandPalette,
149
- when: CommentContextKeys.activeEditorHasCommentingRange
150
- }],
152
+ id: MenuId.CommandPalette,
153
+ when: CommentContextKeys.activeEditorHasCommentingRange
154
+ }],
151
155
  keybinding: {
152
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.DownArrow),
156
+ primary: KeyChord(
157
+ KeyMod.CtrlCmd | KeyCode.KeyK,
158
+ KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.DownArrow
159
+ ),
153
160
  weight: KeybindingWeight.EditorContrib,
154
161
  when: ( ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, ( ContextKeyExpr.or(EditorContextKeys.focus, CommentContextKeys.commentFocused, ( ContextKeyExpr.and(accessibilityHelpIsShown, ( accessibleViewCurrentProviderId.isEqualTo(AccessibleViewProviderId.Comments))))))))
155
162
  }
@@ -172,19 +179,22 @@ registerAction2(class extends Action2 {
172
179
  super({
173
180
  id: CommentCommandId.PreviousRange,
174
181
  title: {
175
- value: ( localize(6362, "Go to Previous Commenting Range")),
176
- original: 'Go to Previous Commenting Range'
182
+ value: ( localize(6671, "Go to Previous Commenting Range")),
183
+ original: "Go to Previous Commenting Range"
177
184
  },
178
185
  category: {
179
- value: ( localize(6359, "Comments")),
180
- original: 'Comments'
186
+ value: ( localize(6668, "Comments")),
187
+ original: "Comments"
181
188
  },
182
189
  menu: [{
183
- id: MenuId.CommandPalette,
184
- when: CommentContextKeys.activeEditorHasCommentingRange
185
- }],
190
+ id: MenuId.CommandPalette,
191
+ when: CommentContextKeys.activeEditorHasCommentingRange
192
+ }],
186
193
  keybinding: {
187
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.UpArrow),
194
+ primary: KeyChord(
195
+ KeyMod.CtrlCmd | KeyCode.KeyK,
196
+ KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.UpArrow
197
+ ),
188
198
  weight: KeybindingWeight.EditorContrib,
189
199
  when: ( ContextKeyExpr.and(CONTEXT_ACCESSIBILITY_MODE_ENABLED, ( ContextKeyExpr.or(EditorContextKeys.focus, CommentContextKeys.commentFocused, ( ContextKeyExpr.and(accessibilityHelpIsShown, ( accessibleViewCurrentProviderId.isEqualTo(AccessibleViewProviderId.Comments))))))))
190
200
  }
@@ -207,17 +217,17 @@ registerAction2(class extends Action2 {
207
217
  super({
208
218
  id: CommentCommandId.ToggleCommenting,
209
219
  title: {
210
- value: ( localize(6363, "Toggle Editor Commenting")),
211
- original: 'Toggle Editor Commenting'
220
+ value: ( localize(6672, "Toggle Editor Commenting")),
221
+ original: "Toggle Editor Commenting"
212
222
  },
213
223
  category: {
214
- value: ( localize(6359, "Comments")),
215
- original: 'Comments'
224
+ value: ( localize(6668, "Comments")),
225
+ original: "Comments"
216
226
  },
217
227
  menu: [{
218
- id: MenuId.CommandPalette,
219
- when: CommentContextKeys.WorkspaceHasCommenting
220
- }]
228
+ id: MenuId.CommandPalette,
229
+ when: CommentContextKeys.WorkspaceHasCommenting
230
+ }]
221
231
  });
222
232
  }
223
233
  run(accessor, ...args) {
@@ -231,17 +241,17 @@ registerAction2(class extends Action2 {
231
241
  super({
232
242
  id: CommentCommandId.Add,
233
243
  title: {
234
- value: ( localize(6364, "Add Comment on Current Selection")),
235
- original: 'Add Comment on Current Selection'
244
+ value: ( localize(6673, "Add Comment on Current Selection")),
245
+ original: "Add Comment on Current Selection"
236
246
  },
237
247
  category: {
238
- value: ( localize(6359, "Comments")),
239
- original: 'Comments'
248
+ value: ( localize(6668, "Comments")),
249
+ original: "Comments"
240
250
  },
241
251
  menu: [{
242
- id: MenuId.CommandPalette,
243
- when: CommentContextKeys.activeCursorHasCommentingRange
244
- }],
252
+ id: MenuId.CommandPalette,
253
+ when: CommentContextKeys.activeCursorHasCommentingRange
254
+ }],
245
255
  keybinding: {
246
256
  primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC),
247
257
  weight: KeybindingWeight.EditorContrib,
@@ -263,8 +273,7 @@ registerAction2(class extends Action2 {
263
273
  args.range.startLineNumber,
264
274
  args.range.endLineNumber,
265
275
  args.range.endColumn
266
- ))
267
- : (args?.fileComment ? undefined : activeEditor.getSelection());
276
+ )) : (args?.fileComment ? undefined : activeEditor.getSelection());
268
277
  await controller.addOrToggleCommentAtLine(position, undefined);
269
278
  }
270
279
  });
@@ -273,15 +282,15 @@ registerAction2(class extends Action2 {
273
282
  super({
274
283
  id: CommentCommandId.FocusCommentOnCurrentLine,
275
284
  title: {
276
- value: ( localize(6365, "Focus Comment on Current Line")),
277
- original: 'Focus Comment on Current Line'
285
+ value: ( localize(6674, "Focus Comment on Current Line")),
286
+ original: "Focus Comment on Current Line"
278
287
  },
279
288
  category: {
280
- value: ( localize(6359, "Comments")),
281
- original: 'Comments'
289
+ value: ( localize(6668, "Comments")),
290
+ original: "Comments"
282
291
  },
283
292
  f1: true,
284
- precondition: CommentContextKeys.activeCursorHasComment,
293
+ precondition: CommentContextKeys.activeCursorHasComment
285
294
  });
286
295
  }
287
296
  async run(accessor, ...args) {
@@ -300,16 +309,19 @@ registerAction2(class extends Action2 {
300
309
  const commentAtLine = controller.getCommentsAtLine(position);
301
310
  if (commentAtLine.length === 0) {
302
311
  error = true;
312
+ } else {
313
+ await controller.revealCommentThread(
314
+ commentAtLine[0].commentThread.threadId,
315
+ undefined,
316
+ false,
317
+ CommentWidgetFocus.Widget
318
+ );
303
319
  }
304
- else {
305
- await controller.revealCommentThread(commentAtLine[0].commentThread.threadId, undefined, false, CommentWidgetFocus.Widget);
306
- }
307
- }
308
- catch (e) {
320
+ } catch (e) {
309
321
  error = true;
310
322
  }
311
323
  if (error) {
312
- notificationService.error(( localize(6366, "The cursor must be on a line with a comment to focus the comment")));
324
+ notificationService.error(( localize(6675, "The cursor must be on a line with a comment to focus the comment")));
313
325
  }
314
326
  }
315
327
  });
@@ -325,17 +337,17 @@ registerAction2(class extends Action2 {
325
337
  super({
326
338
  id: CommentCommandId.CollapseAll,
327
339
  title: {
328
- value: ( localize(6367, "Collapse All Comments")),
329
- original: 'Collapse All Comments'
340
+ value: ( localize(6676, "Collapse All Comments")),
341
+ original: "Collapse All Comments"
330
342
  },
331
343
  category: {
332
- value: ( localize(6359, "Comments")),
333
- original: 'Comments'
344
+ value: ( localize(6668, "Comments")),
345
+ original: "Comments"
334
346
  },
335
347
  menu: [{
336
- id: MenuId.CommandPalette,
337
- when: CommentContextKeys.WorkspaceHasCommenting
338
- }]
348
+ id: MenuId.CommandPalette,
349
+ when: CommentContextKeys.WorkspaceHasCommenting
350
+ }]
339
351
  });
340
352
  }
341
353
  run(accessor, ...args) {
@@ -348,17 +360,17 @@ registerAction2(class extends Action2 {
348
360
  super({
349
361
  id: CommentCommandId.ExpandAll,
350
362
  title: {
351
- value: ( localize(6368, "Expand All Comments")),
352
- original: 'Expand All Comments'
363
+ value: ( localize(6677, "Expand All Comments")),
364
+ original: "Expand All Comments"
353
365
  },
354
366
  category: {
355
- value: ( localize(6359, "Comments")),
356
- original: 'Comments'
367
+ value: ( localize(6668, "Comments")),
368
+ original: "Comments"
357
369
  },
358
370
  menu: [{
359
- id: MenuId.CommandPalette,
360
- when: CommentContextKeys.WorkspaceHasCommenting
361
- }]
371
+ id: MenuId.CommandPalette,
372
+ when: CommentContextKeys.WorkspaceHasCommenting
373
+ }]
362
374
  });
363
375
  }
364
376
  run(accessor, ...args) {
@@ -371,22 +383,22 @@ registerAction2(class extends Action2 {
371
383
  super({
372
384
  id: CommentCommandId.ExpandUnresolved,
373
385
  title: {
374
- value: ( localize(6369, "Expand Unresolved Comments")),
375
- original: 'Expand Unresolved Comments'
386
+ value: ( localize(6678, "Expand Unresolved Comments")),
387
+ original: "Expand Unresolved Comments"
376
388
  },
377
389
  category: {
378
- value: ( localize(6359, "Comments")),
379
- original: 'Comments'
390
+ value: ( localize(6668, "Comments")),
391
+ original: "Comments"
380
392
  },
381
393
  menu: [{
382
- id: MenuId.CommandPalette,
383
- when: CommentContextKeys.WorkspaceHasCommenting
384
- }]
394
+ id: MenuId.CommandPalette,
395
+ when: CommentContextKeys.WorkspaceHasCommenting
396
+ }]
385
397
  });
386
398
  }
387
399
  run(accessor, ...args) {
388
400
  const commentService = accessor.get(ICommentService);
389
- changeAllCollapseState(commentService, (commentThread) => {
401
+ changeAllCollapseState(commentService, commentThread => {
390
402
  return commentThread.state === CommentThreadState.Unresolved ? CommentThreadCollapsibleState.Expanded : CommentThreadCollapsibleState.Collapsed;
391
403
  });
392
404
  }
@@ -412,32 +424,49 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
412
424
  handler: async (accessor, args) => {
413
425
  const activeCodeEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
414
426
  const keybindingService = accessor.get(IKeybindingService);
427
+ const notificationService = accessor.get(INotificationService);
428
+ const commentService = accessor.get(ICommentService);
415
429
  await keybindingService.enableKeybindingHoldMode(CommentCommandId.Hide);
416
430
  if (activeCodeEditor instanceof SimpleCommentEditor) {
417
431
  activeCodeEditor.getParentThread().collapse();
418
- }
419
- else if (activeCodeEditor) {
432
+ } else if (activeCodeEditor) {
420
433
  const controller = CommentController.get(activeCodeEditor);
421
434
  if (!controller) {
422
435
  return;
423
436
  }
424
- const notificationService = accessor.get(INotificationService);
425
- const commentService = accessor.get(ICommentService);
426
437
  let error = false;
427
438
  try {
428
439
  const activeComment = commentService.lastActiveCommentcontroller?.activeComment;
429
440
  if (!activeComment) {
430
441
  error = true;
431
- }
432
- else {
442
+ } else {
433
443
  controller.collapseAndFocusRange(activeComment.thread.threadId);
434
444
  }
435
- }
436
- catch (e) {
445
+ } catch (e) {
437
446
  error = true;
438
447
  }
439
448
  if (error) {
440
- notificationService.error(( localize(6366, "The cursor must be on a line with a comment to focus the comment")));
449
+ notificationService.error(( localize(6675, "The cursor must be on a line with a comment to focus the comment")));
450
+ }
451
+ }
452
+ }
453
+ });
454
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
455
+ id: CommentCommandId.Hide,
456
+ weight: KeybindingWeight.EditorContrib,
457
+ primary: KeyMod.CtrlCmd | KeyCode.Escape,
458
+ win: {
459
+ primary: KeyMod.Alt | KeyCode.Backspace
460
+ },
461
+ when: ( ContextKeyExpr.and(EditorContextKeys.focus, CommentContextKeys.commentWidgetVisible)),
462
+ handler: async (accessor, args) => {
463
+ const activeCodeEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
464
+ const keybindingService = accessor.get(IKeybindingService);
465
+ await keybindingService.enableKeybindingHoldMode(CommentCommandId.Hide);
466
+ if (activeCodeEditor) {
467
+ const controller = CommentController.get(activeCodeEditor);
468
+ if (controller) {
469
+ await controller.collapseVisibleComments();
441
470
  }
442
471
  }
443
472
  }
@@ -447,8 +476,7 @@ function getActiveEditor(accessor) {
447
476
  if (isDiffEditor(activeTextEditorControl)) {
448
477
  if (activeTextEditorControl.getOriginalEditor().hasTextFocus()) {
449
478
  activeTextEditorControl = activeTextEditorControl.getOriginalEditor();
450
- }
451
- else {
479
+ } else {
452
480
  activeTextEditorControl = activeTextEditorControl.getModifiedEditor();
453
481
  }
454
482
  }
@@ -11,35 +11,36 @@ import { applyTextEditorOptions } from '@codingame/monaco-vscode-api/vscode/vs/w
11
11
  import { SimpleCommentEditor } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/comments/browser/simpleCommentEditor';
12
12
 
13
13
  let CommentsInputContentProvider = class CommentsInputContentProvider extends Disposable {
14
- static { this.ID = 'comments.input.contentProvider'; }
14
+ static {
15
+ this.ID = "comments.input.contentProvider";
16
+ }
15
17
  constructor(textModelService, codeEditorService, _modelService, _languageService) {
16
18
  super();
17
19
  this._modelService = _modelService;
18
20
  this._languageService = _languageService;
19
- this._register(textModelService.registerTextModelContentProvider(Schemas.commentsInput, this));
20
- this._register(codeEditorService.registerCodeEditorOpenHandler(async (input, editor, _sideBySide) => {
21
- if (!(editor instanceof SimpleCommentEditor)) {
22
- return null;
23
- }
24
- if (editor.getModel()?.uri.toString() !== ( input.resource.toString())) {
25
- return null;
26
- }
27
- if (input.options) {
28
- applyTextEditorOptions(input.options, editor, ScrollType.Immediate);
29
- }
30
- return editor;
31
- }));
21
+ this._register(
22
+ textModelService.registerTextModelContentProvider(Schemas.commentsInput, this)
23
+ );
24
+ this._register(
25
+ codeEditorService.registerCodeEditorOpenHandler(async (input, editor, _sideBySide) => {
26
+ if (!(editor instanceof SimpleCommentEditor)) {
27
+ return null;
28
+ }
29
+ if (editor.getModel()?.uri.toString() !== ( input.resource.toString())) {
30
+ return null;
31
+ }
32
+ if (input.options) {
33
+ applyTextEditorOptions(input.options, editor, ScrollType.Immediate);
34
+ }
35
+ return editor;
36
+ })
37
+ );
32
38
  }
33
39
  async provideTextContent(resource) {
34
40
  const existing = this._modelService.getModel(resource);
35
- return existing ?? this._modelService.createModel('', this._languageService.createById('markdown'), resource);
41
+ return existing ?? this._modelService.createModel("", this._languageService.createById("markdown"), resource);
36
42
  }
37
43
  };
38
- CommentsInputContentProvider = ( __decorate([
39
- ( __param(0, ITextModelService)),
40
- ( __param(1, ICodeEditorService)),
41
- ( __param(2, IModelService)),
42
- ( __param(3, ILanguageService))
43
- ], CommentsInputContentProvider));
44
+ CommentsInputContentProvider = ( __decorate([( __param(0, ITextModelService)), ( __param(1, ICodeEditorService)), ( __param(2, IModelService)), ( __param(3, ILanguageService))], CommentsInputContentProvider));
44
45
 
45
46
  export { CommentsInputContentProvider };