@codingame/monaco-vscode-comments-service-override 24.3.0 → 25.0.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-comments-service-override",
3
- "version": "24.3.0",
3
+ "version": "25.0.0",
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": "24.3.0"
18
+ "@codingame/monaco-vscode-api": "25.0.0"
19
19
  },
20
20
  "main": "index.js",
21
21
  "module": "index.js",
@@ -33,7 +33,7 @@ registerAction2(class Collapse extends ViewAction {
33
33
  super({
34
34
  viewId: COMMENTS_VIEW_ID,
35
35
  id: 'comments.collapse',
36
- title: ( localize(6297, "Collapse All")),
36
+ title: ( localize(6319, "Collapse All")),
37
37
  f1: false,
38
38
  icon: Codicon.collapseAll,
39
39
  menu: {
@@ -53,7 +53,7 @@ registerAction2(class Expand extends ViewAction {
53
53
  super({
54
54
  viewId: COMMENTS_VIEW_ID,
55
55
  id: 'comments.expand',
56
- title: ( localize(6298, "Expand All")),
56
+ title: ( localize(6320, "Expand All")),
57
57
  f1: false,
58
58
  icon: Codicon.expandAll,
59
59
  menu: {
@@ -72,7 +72,7 @@ registerAction2(class Reply extends Action2 {
72
72
  constructor() {
73
73
  super({
74
74
  id: 'comments.reply',
75
- title: ( localize(6299, "Reply")),
75
+ title: ( localize(6321, "Reply")),
76
76
  icon: Codicon.reply,
77
77
  precondition: ( ContextKeyExpr.equals('canReply', true)),
78
78
  menu: [{
@@ -95,34 +95,34 @@ registerAction2(class Reply extends Action2 {
95
95
  ( Registry.as(Extensions.Configuration)).registerConfiguration({
96
96
  id: 'comments',
97
97
  order: 20,
98
- title: ( localize(6300, "Comments")),
98
+ title: ( localize(6322, "Comments")),
99
99
  type: 'object',
100
100
  properties: {
101
101
  'comments.openPanel': {
102
102
  enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'],
103
103
  default: 'openOnSessionStartWithComments',
104
- description: ( localize(6301, "Controls when the comments panel should open.")),
104
+ description: ( localize(6323, "Controls when the comments panel should open.")),
105
105
  restricted: false,
106
- markdownDeprecationMessage: ( localize(6302, "This setting is deprecated in favor of `comments.openView`."))
106
+ markdownDeprecationMessage: ( localize(6324, "This setting is deprecated in favor of `comments.openView`."))
107
107
  },
108
108
  'comments.openView': {
109
109
  enum: ['never', 'file', 'firstFile', 'firstFileUnresolved'],
110
- enumDescriptions: [( localize(6303, "The comments view will never be opened.")), ( localize(6304, "The comments view will open when a file with comments is active.")), ( localize(
111
- 6305,
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,
112
112
  "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
113
  )), ( localize(
114
- 6306,
114
+ 6328,
115
115
  "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
116
  ))],
117
117
  default: 'firstFile',
118
- description: ( localize(6307, "Controls when the comments view should open.")),
118
+ description: ( localize(6329, "Controls when the comments view should open.")),
119
119
  restricted: false
120
120
  },
121
121
  'comments.useRelativeTime': {
122
122
  type: 'boolean',
123
123
  default: true,
124
124
  description: ( localize(
125
- 6308,
125
+ 6330,
126
126
  "Determines if relative time will be used in comment timestamps (ex. '1 day ago')."
127
127
  ))
128
128
  },
@@ -130,20 +130,20 @@ registerAction2(class Reply extends Action2 {
130
130
  type: 'boolean',
131
131
  default: true,
132
132
  description: ( localize(
133
- 6309,
133
+ 6331,
134
134
  "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
135
  ))
136
136
  },
137
137
  'comments.maxHeight': {
138
138
  type: 'boolean',
139
139
  default: true,
140
- description: ( localize(6310, "Controls whether the comments widget scrolls or expands."))
140
+ description: ( localize(6332, "Controls whether the comments widget scrolls or expands."))
141
141
  },
142
142
  'comments.collapseOnResolve': {
143
143
  type: 'boolean',
144
144
  default: true,
145
145
  description: ( localize(
146
- 6311,
146
+ 6333,
147
147
  "Controls whether the comment thread should collapse when the thread is resolved."
148
148
  ))
149
149
  },
@@ -151,12 +151,12 @@ registerAction2(class Reply extends Action2 {
151
151
  type: 'string',
152
152
  enum: ['whenHasUnsubmittedComments', 'never'],
153
153
  enumDescriptions: [( localize(
154
- 6312,
154
+ 6334,
155
155
  "Show a confirmation dialog when collapsing a comment thread with unsubmitted comments."
156
- )), ( localize(6313, "Never show a confirmation dialog when collapsing a comment thread."))],
156
+ )), ( localize(6335, "Never show a confirmation dialog when collapsing a comment thread."))],
157
157
  default: 'whenHasUnsubmittedComments',
158
158
  description: ( localize(
159
- 6314,
159
+ 6336,
160
160
  "Controls whether a confirmation dialog is shown when collapsing a comment thread."
161
161
  ))
162
162
  }
@@ -198,7 +198,7 @@ let UnresolvedCommentsBadge = class UnresolvedCommentsBadge extends Disposable {
198
198
  return;
199
199
  }
200
200
  this.totalUnresolved = unresolved;
201
- const message = ( localize(6315, '{0} Unresolved Comments', this.totalUnresolved));
201
+ const message = ( localize(6337, '{0} Unresolved Comments', this.totalUnresolved));
202
202
  this.activity.value = this.activityService.showViewActivity(COMMENTS_VIEW_ID, { badge: ( new NumberBadge(this.totalUnresolved, () => message)) });
203
203
  }
204
204
  };
@@ -25,6 +25,7 @@ import { CommentsInputContentProvider } from './commentsInputContentProvider.js'
25
25
  import { AccessibleViewProviderId } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleView';
26
26
  import { CommentWidgetFocus } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/comments/browser/commentThreadZoneWidget';
27
27
  import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
28
+ import { CommentThreadCollapsibleState, CommentThreadState } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages';
28
29
 
29
30
  registerCss(review);
30
31
  registerEditorContribution(ID, CommentController, EditorContributionInstantiation.AfterFirstRender);
@@ -66,11 +67,11 @@ registerAction2(class extends Action2 {
66
67
  super({
67
68
  id: CommentCommandId.NextCommentedRange,
68
69
  title: {
69
- value: ( localize(6336, "Go to Next Commented Range")),
70
+ value: ( localize(6358, "Go to Next Commented Range")),
70
71
  original: 'Go to Next Commented Range'
71
72
  },
72
73
  category: {
73
- value: ( localize(6337, "Comments")),
74
+ value: ( localize(6359, "Comments")),
74
75
  original: 'Comments'
75
76
  },
76
77
  menu: [{
@@ -101,11 +102,11 @@ registerAction2(class extends Action2 {
101
102
  super({
102
103
  id: CommentCommandId.PreviousCommentedRange,
103
104
  title: {
104
- value: ( localize(6338, "Go to Previous Commented Range")),
105
+ value: ( localize(6360, "Go to Previous Commented Range")),
105
106
  original: 'Go to Previous Commented Range'
106
107
  },
107
108
  category: {
108
- value: ( localize(6337, "Comments")),
109
+ value: ( localize(6359, "Comments")),
109
110
  original: 'Comments'
110
111
  },
111
112
  menu: [{
@@ -136,11 +137,11 @@ registerAction2(class extends Action2 {
136
137
  super({
137
138
  id: CommentCommandId.NextRange,
138
139
  title: {
139
- value: ( localize(6339, "Go to Next Commenting Range")),
140
+ value: ( localize(6361, "Go to Next Commenting Range")),
140
141
  original: 'Go to Next Commenting Range'
141
142
  },
142
143
  category: {
143
- value: ( localize(6337, "Comments")),
144
+ value: ( localize(6359, "Comments")),
144
145
  original: 'Comments'
145
146
  },
146
147
  menu: [{
@@ -171,11 +172,11 @@ registerAction2(class extends Action2 {
171
172
  super({
172
173
  id: CommentCommandId.PreviousRange,
173
174
  title: {
174
- value: ( localize(6340, "Go to Previous Commenting Range")),
175
+ value: ( localize(6362, "Go to Previous Commenting Range")),
175
176
  original: 'Go to Previous Commenting Range'
176
177
  },
177
178
  category: {
178
- value: ( localize(6337, "Comments")),
179
+ value: ( localize(6359, "Comments")),
179
180
  original: 'Comments'
180
181
  },
181
182
  menu: [{
@@ -206,11 +207,11 @@ registerAction2(class extends Action2 {
206
207
  super({
207
208
  id: CommentCommandId.ToggleCommenting,
208
209
  title: {
209
- value: ( localize(6341, "Toggle Editor Commenting")),
210
+ value: ( localize(6363, "Toggle Editor Commenting")),
210
211
  original: 'Toggle Editor Commenting'
211
212
  },
212
213
  category: {
213
- value: ( localize(6337, "Comments")),
214
+ value: ( localize(6359, "Comments")),
214
215
  original: 'Comments'
215
216
  },
216
217
  menu: [{
@@ -230,11 +231,11 @@ registerAction2(class extends Action2 {
230
231
  super({
231
232
  id: CommentCommandId.Add,
232
233
  title: {
233
- value: ( localize(6342, "Add Comment on Current Selection")),
234
+ value: ( localize(6364, "Add Comment on Current Selection")),
234
235
  original: 'Add Comment on Current Selection'
235
236
  },
236
237
  category: {
237
- value: ( localize(6337, "Comments")),
238
+ value: ( localize(6359, "Comments")),
238
239
  original: 'Comments'
239
240
  },
240
241
  menu: [{
@@ -272,11 +273,11 @@ registerAction2(class extends Action2 {
272
273
  super({
273
274
  id: CommentCommandId.FocusCommentOnCurrentLine,
274
275
  title: {
275
- value: ( localize(6343, "Focus Comment on Current Line")),
276
+ value: ( localize(6365, "Focus Comment on Current Line")),
276
277
  original: 'Focus Comment on Current Line'
277
278
  },
278
279
  category: {
279
- value: ( localize(6337, "Comments")),
280
+ value: ( localize(6359, "Comments")),
280
281
  original: 'Comments'
281
282
  },
282
283
  f1: true,
@@ -308,20 +309,27 @@ registerAction2(class extends Action2 {
308
309
  error = true;
309
310
  }
310
311
  if (error) {
311
- notificationService.error(( localize(6344, "The cursor must be on a line with a comment to focus the comment")));
312
+ notificationService.error(( localize(6366, "The cursor must be on a line with a comment to focus the comment")));
312
313
  }
313
314
  }
314
315
  });
316
+ function changeAllCollapseState(commentService, newState) {
317
+ for (const resource of commentService.commentsModel.resourceCommentThreads) {
318
+ for (const thread of resource.commentThreads) {
319
+ thread.thread.collapsibleState = newState(thread.thread);
320
+ }
321
+ }
322
+ }
315
323
  registerAction2(class extends Action2 {
316
324
  constructor() {
317
325
  super({
318
326
  id: CommentCommandId.CollapseAll,
319
327
  title: {
320
- value: ( localize(6345, "Collapse All Comments")),
328
+ value: ( localize(6367, "Collapse All Comments")),
321
329
  original: 'Collapse All Comments'
322
330
  },
323
331
  category: {
324
- value: ( localize(6337, "Comments")),
332
+ value: ( localize(6359, "Comments")),
325
333
  original: 'Comments'
326
334
  },
327
335
  menu: [{
@@ -331,7 +339,8 @@ registerAction2(class extends Action2 {
331
339
  });
332
340
  }
333
341
  run(accessor, ...args) {
334
- getActiveController(accessor)?.collapseAll();
342
+ const commentService = accessor.get(ICommentService);
343
+ changeAllCollapseState(commentService, () => CommentThreadCollapsibleState.Collapsed);
335
344
  }
336
345
  });
337
346
  registerAction2(class extends Action2 {
@@ -339,11 +348,11 @@ registerAction2(class extends Action2 {
339
348
  super({
340
349
  id: CommentCommandId.ExpandAll,
341
350
  title: {
342
- value: ( localize(6346, "Expand All Comments")),
351
+ value: ( localize(6368, "Expand All Comments")),
343
352
  original: 'Expand All Comments'
344
353
  },
345
354
  category: {
346
- value: ( localize(6337, "Comments")),
355
+ value: ( localize(6359, "Comments")),
347
356
  original: 'Comments'
348
357
  },
349
358
  menu: [{
@@ -353,7 +362,8 @@ registerAction2(class extends Action2 {
353
362
  });
354
363
  }
355
364
  run(accessor, ...args) {
356
- getActiveController(accessor)?.expandAll();
365
+ const commentService = accessor.get(ICommentService);
366
+ changeAllCollapseState(commentService, () => CommentThreadCollapsibleState.Expanded);
357
367
  }
358
368
  });
359
369
  registerAction2(class extends Action2 {
@@ -361,11 +371,11 @@ registerAction2(class extends Action2 {
361
371
  super({
362
372
  id: CommentCommandId.ExpandUnresolved,
363
373
  title: {
364
- value: ( localize(6347, "Expand Unresolved Comments")),
374
+ value: ( localize(6369, "Expand Unresolved Comments")),
365
375
  original: 'Expand Unresolved Comments'
366
376
  },
367
377
  category: {
368
- value: ( localize(6337, "Comments")),
378
+ value: ( localize(6359, "Comments")),
369
379
  original: 'Comments'
370
380
  },
371
381
  menu: [{
@@ -375,7 +385,10 @@ registerAction2(class extends Action2 {
375
385
  });
376
386
  }
377
387
  run(accessor, ...args) {
378
- getActiveController(accessor)?.expandUnresolved();
388
+ const commentService = accessor.get(ICommentService);
389
+ changeAllCollapseState(commentService, (commentThread) => {
390
+ return commentThread.state === CommentThreadState.Unresolved ? CommentThreadCollapsibleState.Expanded : CommentThreadCollapsibleState.Collapsed;
391
+ });
379
392
  }
380
393
  });
381
394
  KeybindingsRegistry.registerCommandAndKeybindingRule({
@@ -424,7 +437,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
424
437
  error = true;
425
438
  }
426
439
  if (error) {
427
- notificationService.error(( localize(6344, "The cursor must be on a line with a comment to focus the comment")));
440
+ notificationService.error(( localize(6366, "The cursor must be on a line with a comment to focus the comment")));
428
441
  }
429
442
  }
430
443
  }
@@ -444,16 +457,5 @@ function getActiveEditor(accessor) {
444
457
  }
445
458
  return activeTextEditorControl;
446
459
  }
447
- function getActiveController(accessor) {
448
- const activeEditor = getActiveEditor(accessor);
449
- if (!activeEditor) {
450
- return undefined;
451
- }
452
- const controller = CommentController.get(activeEditor);
453
- if (!controller) {
454
- return undefined;
455
- }
456
- return controller;
457
- }
458
460
 
459
461
  export { getActiveEditor };