@codingame/monaco-vscode-comments-service-override 7.1.0 → 8.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": "7.1.0",
3
+ "version": "8.0.0",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@7.1.0"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@8.0.0"
30
30
  }
31
31
  }
@@ -1,5 +1,5 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
2
+ import { localize } from 'vscode/vscode/vs/nls';
3
3
  import 'vscode/vscode/vs/platform/instantiation/common/extensions';
4
4
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
5
  import './commentsEditorContribution.js';
@@ -27,13 +27,12 @@ import { AccessibleViewRegistry } from 'vscode/vscode/vs/platform/accessibility/
27
27
  import { CommentsAccessibleView } from './commentsAccessibleView.js';
28
28
  import { CommentsAccessibilityHelp } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsAccessibility';
29
29
 
30
- const _moduleId = "vs/workbench/contrib/comments/browser/comments.contribution";
31
30
  registerAction2(class Collapse extends ViewAction {
32
31
  constructor() {
33
32
  super({
34
33
  viewId: COMMENTS_VIEW_ID,
35
34
  id: 'comments.collapse',
36
- title: ( localizeWithPath(_moduleId, 0, "Collapse All")),
35
+ title: ( localize(1611, "Collapse All")),
37
36
  f1: false,
38
37
  icon: Codicon.collapseAll,
39
38
  menu: {
@@ -56,7 +55,7 @@ registerAction2(class Expand extends ViewAction {
56
55
  super({
57
56
  viewId: COMMENTS_VIEW_ID,
58
57
  id: 'comments.expand',
59
- title: ( localizeWithPath(_moduleId, 1, "Expand All")),
58
+ title: ( localize(1612, "Expand All")),
60
59
  f1: false,
61
60
  icon: Codicon.expandAll,
62
61
  menu: {
@@ -78,7 +77,7 @@ registerAction2(class Reply extends Action2 {
78
77
  constructor() {
79
78
  super({
80
79
  id: 'comments.reply',
81
- title: ( localizeWithPath(_moduleId, 2, "Reply")),
80
+ title: ( localize(1613, "Reply")),
82
81
  icon: Codicon.reply,
83
82
  precondition: ( (ContextKeyExpr.equals('canReply', true))),
84
83
  menu: [{
@@ -104,68 +103,55 @@ registerAction2(class Reply extends Action2 {
104
103
  ( (Registry.as(Extensions.Configuration))).registerConfiguration({
105
104
  id: 'comments',
106
105
  order: 20,
107
- title: ( localizeWithPath(_moduleId, 3, "Comments")),
106
+ title: ( localize(1614, "Comments")),
108
107
  type: 'object',
109
108
  properties: {
110
109
  'comments.openPanel': {
111
110
  enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'],
112
111
  default: 'openOnSessionStartWithComments',
113
- description: ( localizeWithPath(_moduleId, 4, "Controls when the comments panel should open.")),
112
+ description: ( localize(1615, "Controls when the comments panel should open.")),
114
113
  restricted: false,
115
- markdownDeprecationMessage: ( localizeWithPath(
116
- _moduleId,
117
- 5,
118
- "This setting is deprecated in favor of `comments.openView`."
119
- ))
114
+ markdownDeprecationMessage: ( localize(1616, "This setting is deprecated in favor of `comments.openView`."))
120
115
  },
121
116
  'comments.openView': {
122
117
  enum: ['never', 'file', 'firstFile', 'firstFileUnresolved'],
123
- enumDescriptions: [( localizeWithPath(_moduleId, 6, "The comments view will never be opened.")), ( localizeWithPath(
124
- _moduleId,
125
- 7,
126
- "The comments view will open when a file with comments is active."
127
- )), ( localizeWithPath(
128
- _moduleId,
129
- 8,
118
+ enumDescriptions: [( localize(1617, "The comments view will never be opened.")), ( localize(1618, "The comments view will open when a file with comments is active.")), ( localize(
119
+ 1619,
130
120
  "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."
131
- )), ( localizeWithPath(
132
- _moduleId,
133
- 9,
121
+ )), ( localize(
122
+ 1620,
134
123
  "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."
135
124
  ))],
136
125
  default: 'firstFile',
137
- description: ( localizeWithPath(_moduleId, 10, "Controls when the comments view should open.")),
126
+ description: ( localize(1621, "Controls when the comments view should open.")),
138
127
  restricted: false
139
128
  },
140
129
  'comments.useRelativeTime': {
141
130
  type: 'boolean',
142
131
  default: true,
143
- description: ( localizeWithPath(
144
- _moduleId,
145
- 11,
132
+ description: ( localize(
133
+ 1622,
146
134
  "Determines if relative time will be used in comment timestamps (ex. '1 day ago')."
147
135
  ))
148
136
  },
149
137
  'comments.visible': {
150
138
  type: 'boolean',
151
139
  default: true,
152
- description: ( localizeWithPath(
153
- _moduleId,
154
- 12,
140
+ description: ( localize(
141
+ 1623,
155
142
  "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."
156
143
  ))
157
144
  },
158
145
  'comments.maxHeight': {
159
146
  type: 'boolean',
160
147
  default: true,
161
- description: ( localizeWithPath(_moduleId, 13, "Controls whether the comments widget scrolls or expands."))
148
+ description: ( localize(1624, "Controls whether the comments widget scrolls or expands."))
162
149
  },
163
150
  'comments.collapseOnResolve': {
164
151
  type: 'boolean',
165
152
  default: true,
166
- description: ( localizeWithPath(
167
- _moduleId,
168
- 14,
153
+ description: ( localize(
154
+ 1625,
169
155
  "Controls whether the comment thread should collapse when the thread is resolved."
170
156
  ))
171
157
  }
@@ -206,7 +192,7 @@ let UnresolvedCommentsBadge = class UnresolvedCommentsBadge extends Disposable {
206
192
  return;
207
193
  }
208
194
  this.totalUnresolved = unresolved;
209
- const message = ( localizeWithPath(_moduleId, 15, '{0} Unresolved Comments', this.totalUnresolved));
195
+ const message = ( localize(1626, '{0} Unresolved Comments', this.totalUnresolved));
210
196
  this.activity.value = this.activityService.showViewActivity(COMMENTS_VIEW_ID, { badge: ( (new NumberBadge(this.totalUnresolved, () => message))) });
211
197
  }
212
198
  };
@@ -1,11 +1,11 @@
1
1
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
2
2
  import { MarshalledId } from 'vscode/vscode/vs/base/common/marshallingIds';
3
- import { AccessibleViewProviderId, AccessibleViewType } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
3
+ import { AccessibleViewType, AccessibleViewProviderId } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
4
4
  import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
5
5
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
6
6
  import { AccessibilityVerbositySettingId } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
7
7
  import { COMMENTS_VIEW_ID, CommentsMenus } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsTreeViewer';
8
- import { CONTEXT_KEY_HAS_COMMENTS } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsView';
8
+ import { CONTEXT_KEY_COMMENT_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsView';
9
9
  import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
10
10
 
11
11
  class CommentsAccessibleView extends Disposable {
@@ -14,67 +14,65 @@ class CommentsAccessibleView extends Disposable {
14
14
  const viewsService = accessor.get(IViewsService);
15
15
  const menuService = accessor.get(IMenuService);
16
16
  const commentsView = viewsService.getActiveViewWithId(COMMENTS_VIEW_ID);
17
- if (!commentsView) {
17
+ const focusedCommentNode = commentsView?.focusedCommentNode;
18
+ if (!commentsView || !focusedCommentNode) {
18
19
  return;
19
20
  }
20
21
  const menus = this._register(( new CommentsMenus(menuService)));
21
22
  menus.setContextKeyService(contextKeyService);
22
- function resolveProvider() {
23
- if (!commentsView) {
24
- return;
25
- }
26
- const commentNode = commentsView.focusedCommentNode;
27
- const content = commentsView.focusedCommentInfo?.toString();
28
- if (!commentNode || !content) {
29
- return;
30
- }
31
- const menuActions = [...menus.getResourceContextActions(commentNode)].filter(i => i.enabled);
32
- const actions = ( menuActions.map(action => {
33
- return {
34
- ...action,
35
- run: () => {
36
- commentsView.focus();
37
- action.run({
38
- thread: commentNode.thread,
39
- $mid: MarshalledId.CommentThread,
40
- commentControlHandle: commentNode.controllerHandle,
41
- commentThreadHandle: commentNode.threadHandle,
42
- });
43
- }
44
- };
45
- }));
46
- return {
47
- id: AccessibleViewProviderId.Notification,
48
- provideContent: () => {
49
- return content;
50
- },
51
- onClose() {
52
- commentsView.focus();
53
- },
54
- next() {
55
- commentsView.focus();
56
- commentsView.focusNextNode();
57
- resolveProvider();
58
- },
59
- previous() {
60
- commentsView.focus();
61
- commentsView.focusPreviousNode();
62
- resolveProvider();
63
- },
64
- verbositySettingKey: AccessibilityVerbositySettingId.Comments,
65
- options: { type: AccessibleViewType.View },
66
- actions
67
- };
68
- }
69
- return resolveProvider();
23
+ return ( new CommentsAccessibleContentProvider(commentsView, focusedCommentNode, menus));
70
24
  }
71
25
  constructor() {
72
26
  super();
73
27
  this.priority = 90;
74
28
  this.name = 'comment';
75
- this.when = CONTEXT_KEY_HAS_COMMENTS;
29
+ this.when = CONTEXT_KEY_COMMENT_FOCUSED;
76
30
  this.type = AccessibleViewType.View;
77
31
  }
78
32
  }
33
+ class CommentsAccessibleContentProvider extends Disposable {
34
+ constructor(_commentsView, _focusedCommentNode, _menus) {
35
+ super();
36
+ this._commentsView = _commentsView;
37
+ this._focusedCommentNode = _focusedCommentNode;
38
+ this._menus = _menus;
39
+ this.id = AccessibleViewProviderId.Comments;
40
+ this.verbositySettingKey = AccessibilityVerbositySettingId.Comments;
41
+ this.options = { type: AccessibleViewType.View };
42
+ this.actions = ( [...this._menus.getResourceContextActions(this._focusedCommentNode)].filter(i => i.enabled).map(action => {
43
+ return {
44
+ ...action,
45
+ run: () => {
46
+ this._commentsView.focus();
47
+ action.run({
48
+ thread: this._focusedCommentNode.thread,
49
+ $mid: MarshalledId.CommentThread,
50
+ commentControlHandle: this._focusedCommentNode.controllerHandle,
51
+ commentThreadHandle: this._focusedCommentNode.threadHandle,
52
+ });
53
+ }
54
+ };
55
+ }));
56
+ }
57
+ provideContent() {
58
+ const commentNode = this._commentsView.focusedCommentNode;
59
+ const content = this._commentsView.focusedCommentInfo?.toString();
60
+ if (!commentNode || !content) {
61
+ throw ( new Error('Comment tree is focused but no comment is selected'));
62
+ }
63
+ return content;
64
+ }
65
+ onClose() {
66
+ this._commentsView.focus();
67
+ }
68
+ provideNextContent() {
69
+ this._commentsView.focusNextNode();
70
+ return this.provideContent();
71
+ }
72
+ providePreviousContent() {
73
+ this._commentsView.focusPreviousNode();
74
+ return this.provideContent();
75
+ }
76
+ }
79
77
 
80
78
  export { CommentsAccessibleView };
@@ -3,7 +3,7 @@ import 'vscode/vscode/vs/workbench/contrib/comments/browser/media/review.css';
3
3
  import { isDiffEditor, isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
4
4
  import { registerEditorContribution, EditorContributionInstantiation } from 'vscode/vscode/vs/editor/browser/editorExtensions';
5
5
  import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
6
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
6
+ import { localize } from 'vscode/vscode/vs/nls';
7
7
  import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
8
8
  import { KeybindingsRegistry, KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
9
9
  import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService.service';
@@ -23,7 +23,6 @@ import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs
23
23
  import { CommentsInputContentProvider } from './commentsInputContentProvider.js';
24
24
  import { AccessibleViewProviderId } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
25
25
 
26
- const _moduleId = "vs/workbench/contrib/comments/browser/commentsEditorContribution";
27
26
  registerEditorContribution(ID, CommentController, EditorContributionInstantiation.AfterFirstRender);
28
27
  registerWorkbenchContribution2(CommentsInputContentProvider.ID, CommentsInputContentProvider, WorkbenchPhase.BlockRestore);
29
28
  KeybindingsRegistry.registerCommandAndKeybindingRule({
@@ -85,7 +84,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
85
84
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
86
85
  command: {
87
86
  id: CommentCommandId.NextRange,
88
- title: ( localizeWithPath(_moduleId, 0, "Go to Next Commenting Range")),
87
+ title: ( localize(5250, "Go to Next Commenting Range")),
89
88
  category: 'Comments',
90
89
  },
91
90
  when: CommentContextKeys.activeEditorHasCommentingRange
@@ -117,7 +116,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
117
116
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
118
117
  command: {
119
118
  id: CommentCommandId.PreviousRange,
120
- title: ( localizeWithPath(_moduleId, 1, "Go to Previous Commenting Range")),
119
+ title: ( localize(5251, "Go to Previous Commenting Range")),
121
120
  category: 'Comments',
122
121
  },
123
122
  when: CommentContextKeys.activeEditorHasCommentingRange
@@ -133,7 +132,7 @@ CommandsRegistry.registerCommand({
133
132
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
134
133
  command: {
135
134
  id: CommentCommandId.ToggleCommenting,
136
- title: ( localizeWithPath(_moduleId, 2, "Toggle Editor Commenting")),
135
+ title: ( localize(5252, "Toggle Editor Commenting")),
137
136
  category: 'Comments',
138
137
  },
139
138
  when: CommentContextKeys.WorkspaceHasCommenting
@@ -161,11 +160,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
161
160
  await controller.addOrToggleCommentAtLine(position, undefined);
162
161
  }
163
162
  catch (e) {
164
- notificationService.error(( localizeWithPath(
165
- _moduleId,
166
- 3,
167
- "The cursor must be within a commenting range to add a comment"
168
- )));
163
+ notificationService.error(( localize(5253, "The cursor must be within a commenting range to add a comment")));
169
164
  }
170
165
  },
171
166
  weight: KeybindingWeight.EditorContrib,
@@ -174,7 +169,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
174
169
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
175
170
  command: {
176
171
  id: CommentCommandId.Add,
177
- title: ( localizeWithPath(_moduleId, 4, "Add Comment on Current Selection")),
172
+ title: ( localize(5254, "Add Comment on Current Selection")),
178
173
  category: 'Comments'
179
174
  },
180
175
  when: CommentContextKeys.activeCursorHasCommentingRange
@@ -188,7 +183,7 @@ CommandsRegistry.registerCommand({
188
183
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
189
184
  command: {
190
185
  id: CommentCommandId.CollapseAll,
191
- title: ( localizeWithPath(_moduleId, 5, "Collapse All Comments")),
186
+ title: ( localize(5255, "Collapse All Comments")),
192
187
  category: 'Comments'
193
188
  },
194
189
  when: CommentContextKeys.WorkspaceHasCommenting
@@ -202,7 +197,7 @@ CommandsRegistry.registerCommand({
202
197
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
203
198
  command: {
204
199
  id: CommentCommandId.ExpandAll,
205
- title: ( localizeWithPath(_moduleId, 6, "Expand All Comments")),
200
+ title: ( localize(5256, "Expand All Comments")),
206
201
  category: 'Comments'
207
202
  },
208
203
  when: CommentContextKeys.WorkspaceHasCommenting
@@ -216,7 +211,7 @@ CommandsRegistry.registerCommand({
216
211
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
217
212
  command: {
218
213
  id: CommentCommandId.ExpandUnresolved,
219
- title: ( localizeWithPath(_moduleId, 7, "Expand Unresolved Comments")),
214
+ title: ( localize(5257, "Expand Unresolved Comments")),
220
215
  category: 'Comments'
221
216
  },
222
217
  when: CommentContextKeys.WorkspaceHasCommenting