@codingame/monaco-vscode-comments-service-override 9.0.2 → 10.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": "9.0.2",
3
+ "version": "10.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@9.0.2"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@10.0.0"
30
30
  }
31
31
  }
@@ -9,7 +9,6 @@ import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/lay
9
9
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
10
10
  import { COMMENTS_SECTION } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentsConfiguration';
11
11
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
12
- import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
13
12
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
14
13
  import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
15
14
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
@@ -61,12 +60,12 @@ let CommentService = class CommentService extends Disposable {
61
60
  this._handleZenMode();
62
61
  this._workspaceHasCommenting = CommentContextKeys.WorkspaceHasCommenting.bindTo(contextKeyService);
63
62
  const storageListener = this._register(( new DisposableStore()));
64
- const storageEvent = Event.debounce(this.storageService.onDidChangeValue(StorageScope.WORKSPACE, CONTINUE_ON_COMMENTS, storageListener), (last, event) => last?.external ? last : event, 500);
63
+ const storageEvent = Event.debounce(this.storageService.onDidChangeValue(1 , CONTINUE_ON_COMMENTS, storageListener), (last, event) => last?.external ? last : event, 500);
65
64
  storageListener.add(storageEvent(v => {
66
65
  if (!v.external) {
67
66
  return;
68
67
  }
69
- const commentsToRestore = this.storageService.getObject(CONTINUE_ON_COMMENTS, StorageScope.WORKSPACE);
68
+ const commentsToRestore = this.storageService.getObject(CONTINUE_ON_COMMENTS, 1 );
70
69
  if (!commentsToRestore) {
71
70
  return;
72
71
  }
@@ -148,6 +147,9 @@ let CommentService = class CommentService extends Disposable {
148
147
  setActiveEditingCommentThread(commentThread) {
149
148
  this._onDidChangeActiveEditingCommentThread.fire(commentThread);
150
149
  }
150
+ get lastActiveCommentcontroller() {
151
+ return this._lastActiveCommentController;
152
+ }
151
153
  async setActiveCommentAndThread(uniqueOwner, commentInfo) {
152
154
  const commentController = this._commentControls.get(uniqueOwner);
153
155
  if (!commentController) {
@@ -310,7 +312,7 @@ let CommentService = class CommentService extends Disposable {
310
312
  commentsToSave.push(...pendingComments);
311
313
  }
312
314
  this.logService.debug(`Comments: URIs of continue on comments to add to storage ${( commentsToSave.map(thread => ( thread.uri.toString()))).join(', ')}.`);
313
- this.storageService.store(CONTINUE_ON_COMMENTS, commentsToSave, StorageScope.WORKSPACE, StorageTarget.USER);
315
+ this.storageService.store(CONTINUE_ON_COMMENTS, commentsToSave, 1 , 0 );
314
316
  }
315
317
  removeContinueOnComment(pendingComment) {
316
318
  const pendingComments = this._continueOnComments.get(pendingComment.uniqueOwner);
@@ -1,6 +1,5 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { localize } from 'vscode/vscode/vs/nls';
3
- import 'vscode/vscode/vs/platform/instantiation/common/extensions';
4
3
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
4
  import './commentsEditorContribution.js';
6
5
  import './commentService.js';
@@ -13,7 +12,6 @@ import { NumberBadge } from 'vscode/vscode/vs/workbench/services/activity/common
13
12
  import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
14
13
  import { COMMENTS_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsTreeViewer';
15
14
  import { CommentThreadState } from 'vscode/vscode/vs/editor/common/languages';
16
- import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
17
15
  import { registerAction2, MenuId, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
18
16
  import { CONTEXT_KEY_HAS_COMMENTS, CONTEXT_KEY_SOME_COMMENTS_EXPANDED } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsView';
19
17
  import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
@@ -22,9 +20,8 @@ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/commo
22
20
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
23
21
  import { revealCommentThread } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsController';
24
22
  import { accessibleViewIsShown, accessibleViewCurrentProviderId } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
25
- import { AccessibleViewProviderId } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
26
23
  import { AccessibleViewRegistry } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleViewRegistry';
27
- import { CommentsAccessibleView } from './commentsAccessibleView.js';
24
+ import { CommentsAccessibleView, CommentThreadAccessibleView } from './commentsAccessibleView.js';
28
25
  import { CommentsAccessibilityHelp } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsAccessibility';
29
26
 
30
27
  registerAction2(class Collapse extends ViewAction {
@@ -32,7 +29,7 @@ registerAction2(class Collapse extends ViewAction {
32
29
  super({
33
30
  viewId: COMMENTS_VIEW_ID,
34
31
  id: 'comments.collapse',
35
- title: ( localize(2130, "Collapse All")),
32
+ title: ( localize(2141, "Collapse All")),
36
33
  f1: false,
37
34
  icon: Codicon.collapseAll,
38
35
  menu: {
@@ -55,7 +52,7 @@ registerAction2(class Expand extends ViewAction {
55
52
  super({
56
53
  viewId: COMMENTS_VIEW_ID,
57
54
  id: 'comments.expand',
58
- title: ( localize(2131, "Expand All")),
55
+ title: ( localize(2142, "Expand All")),
59
56
  f1: false,
60
57
  icon: Codicon.expandAll,
61
58
  menu: {
@@ -77,7 +74,7 @@ registerAction2(class Reply extends Action2 {
77
74
  constructor() {
78
75
  super({
79
76
  id: 'comments.reply',
80
- title: ( localize(2132, "Reply")),
77
+ title: ( localize(2143, "Reply")),
81
78
  icon: Codicon.reply,
82
79
  precondition: ( (ContextKeyExpr.equals('canReply', true))),
83
80
  menu: [{
@@ -86,10 +83,10 @@ registerAction2(class Reply extends Action2 {
86
83
  },
87
84
  {
88
85
  id: MenuId.AccessibleView,
89
- when: ( (ContextKeyExpr.and(
90
- accessibleViewIsShown,
91
- (ContextKeyExpr.equals(accessibleViewCurrentProviderId.key, AccessibleViewProviderId.Comments))
92
- ))),
86
+ when: ( (ContextKeyExpr.and(accessibleViewIsShown, (ContextKeyExpr.equals(
87
+ accessibleViewCurrentProviderId.key,
88
+ "comments"
89
+ ))))),
93
90
  }]
94
91
  });
95
92
  }
@@ -103,34 +100,34 @@ registerAction2(class Reply extends Action2 {
103
100
  ( (Registry.as(Extensions.Configuration))).registerConfiguration({
104
101
  id: 'comments',
105
102
  order: 20,
106
- title: ( localize(2133, "Comments")),
103
+ title: ( localize(2144, "Comments")),
107
104
  type: 'object',
108
105
  properties: {
109
106
  'comments.openPanel': {
110
107
  enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'],
111
108
  default: 'openOnSessionStartWithComments',
112
- description: ( localize(2134, "Controls when the comments panel should open.")),
109
+ description: ( localize(2145, "Controls when the comments panel should open.")),
113
110
  restricted: false,
114
- markdownDeprecationMessage: ( localize(2135, "This setting is deprecated in favor of `comments.openView`."))
111
+ markdownDeprecationMessage: ( localize(2146, "This setting is deprecated in favor of `comments.openView`."))
115
112
  },
116
113
  'comments.openView': {
117
114
  enum: ['never', 'file', 'firstFile', 'firstFileUnresolved'],
118
- enumDescriptions: [( localize(2136, "The comments view will never be opened.")), ( localize(2137, "The comments view will open when a file with comments is active.")), ( localize(
119
- 2138,
115
+ enumDescriptions: [( localize(2147, "The comments view will never be opened.")), ( localize(2148, "The comments view will open when a file with comments is active.")), ( localize(
116
+ 2149,
120
117
  "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."
121
118
  )), ( localize(
122
- 2139,
119
+ 2150,
123
120
  "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."
124
121
  ))],
125
122
  default: 'firstFile',
126
- description: ( localize(2140, "Controls when the comments view should open.")),
123
+ description: ( localize(2151, "Controls when the comments view should open.")),
127
124
  restricted: false
128
125
  },
129
126
  'comments.useRelativeTime': {
130
127
  type: 'boolean',
131
128
  default: true,
132
129
  description: ( localize(
133
- 2141,
130
+ 2152,
134
131
  "Determines if relative time will be used in comment timestamps (ex. '1 day ago')."
135
132
  ))
136
133
  },
@@ -138,20 +135,20 @@ registerAction2(class Reply extends Action2 {
138
135
  type: 'boolean',
139
136
  default: true,
140
137
  description: ( localize(
141
- 2142,
138
+ 2153,
142
139
  "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."
143
140
  ))
144
141
  },
145
142
  'comments.maxHeight': {
146
143
  type: 'boolean',
147
144
  default: true,
148
- description: ( localize(2143, "Controls whether the comments widget scrolls or expands."))
145
+ description: ( localize(2154, "Controls whether the comments widget scrolls or expands."))
149
146
  },
150
147
  'comments.collapseOnResolve': {
151
148
  type: 'boolean',
152
149
  default: true,
153
150
  description: ( localize(
154
- 2144,
151
+ 2155,
155
152
  "Controls whether the comment thread should collapse when the thread is resolved."
156
153
  ))
157
154
  }
@@ -192,7 +189,7 @@ let UnresolvedCommentsBadge = class UnresolvedCommentsBadge extends Disposable {
192
189
  return;
193
190
  }
194
191
  this.totalUnresolved = unresolved;
195
- const message = ( localize(2145, '{0} Unresolved Comments', this.totalUnresolved));
192
+ const message = ( localize(2156, '{0} Unresolved Comments', this.totalUnresolved));
196
193
  this.activity.value = this.activityService.showViewActivity(COMMENTS_VIEW_ID, { badge: ( (new NumberBadge(this.totalUnresolved, () => message))) });
197
194
  }
198
195
  };
@@ -200,8 +197,9 @@ UnresolvedCommentsBadge = ( (__decorate([
200
197
  ( (__param(0, ICommentService))),
201
198
  ( (__param(1, IActivityService)))
202
199
  ], UnresolvedCommentsBadge)));
203
- ( (Registry.as(Extensions$1.Workbench))).registerWorkbenchContribution(UnresolvedCommentsBadge, LifecyclePhase.Eventually);
200
+ ( (Registry.as(Extensions$1.Workbench))).registerWorkbenchContribution(UnresolvedCommentsBadge, 4 );
204
201
  AccessibleViewRegistry.register(( (new CommentsAccessibleView())));
202
+ AccessibleViewRegistry.register(( (new CommentThreadAccessibleView())));
205
203
  AccessibleViewRegistry.register(( (new CommentsAccessibilityHelp())));
206
204
 
207
205
  export { UnresolvedCommentsBadge };
@@ -1,12 +1,17 @@
1
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
2
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
2
- import { MarshalledId } from 'vscode/vscode/vs/base/common/marshallingIds';
3
- import { AccessibleViewType, AccessibleViewProviderId } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
4
3
  import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
5
4
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
6
- import { AccessibilityVerbositySettingId } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
7
5
  import { COMMENTS_VIEW_ID, CommentsMenus } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsTreeViewer';
8
6
  import { CONTEXT_KEY_COMMENT_FOCUSED } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsView';
9
7
  import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
8
+ import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService.service';
9
+ import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
10
+ import { revealCommentThread, moveToNextCommentInThread } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsController';
11
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
12
+ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
13
+ import { isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
14
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
10
15
 
11
16
  class CommentsAccessibleView extends Disposable {
12
17
  getProvider(accessor) {
@@ -27,7 +32,26 @@ class CommentsAccessibleView extends Disposable {
27
32
  this.priority = 90;
28
33
  this.name = 'comment';
29
34
  this.when = CONTEXT_KEY_COMMENT_FOCUSED;
30
- this.type = AccessibleViewType.View;
35
+ this.type = "view" ;
36
+ }
37
+ }
38
+ class CommentThreadAccessibleView extends Disposable {
39
+ getProvider(accessor) {
40
+ const commentService = accessor.get(ICommentService);
41
+ const editorService = accessor.get(IEditorService);
42
+ const uriIdentityService = accessor.get(IUriIdentityService);
43
+ const threads = commentService.commentsModel.hasCommentThreads();
44
+ if (!threads) {
45
+ return;
46
+ }
47
+ return ( new CommentsThreadWidgetAccessibleContentProvider(commentService, editorService, uriIdentityService));
48
+ }
49
+ constructor() {
50
+ super();
51
+ this.priority = 85;
52
+ this.name = 'commentThread';
53
+ this.when = CommentContextKeys.commentFocused;
54
+ this.type = "view" ;
31
55
  }
32
56
  }
33
57
  class CommentsAccessibleContentProvider extends Disposable {
@@ -36,9 +60,9 @@ class CommentsAccessibleContentProvider extends Disposable {
36
60
  this._commentsView = _commentsView;
37
61
  this._focusedCommentNode = _focusedCommentNode;
38
62
  this._menus = _menus;
39
- this.id = AccessibleViewProviderId.Comments;
40
- this.verbositySettingKey = AccessibilityVerbositySettingId.Comments;
41
- this.options = { type: AccessibleViewType.View };
63
+ this.id = "comments" ;
64
+ this.verbositySettingKey = "accessibility.verbosity.comments" ;
65
+ this.options = { type: "view" };
42
66
  this.actions = ( [...this._menus.getResourceContextActions(this._focusedCommentNode)].filter(i => i.enabled).map(action => {
43
67
  return {
44
68
  ...action,
@@ -46,7 +70,7 @@ class CommentsAccessibleContentProvider extends Disposable {
46
70
  this._commentsView.focus();
47
71
  action.run({
48
72
  thread: this._focusedCommentNode.thread,
49
- $mid: MarshalledId.CommentThread,
73
+ $mid: 7 ,
50
74
  commentControlHandle: this._focusedCommentNode.controllerHandle,
51
75
  commentThreadHandle: this._focusedCommentNode.threadHandle,
52
76
  });
@@ -74,5 +98,71 @@ class CommentsAccessibleContentProvider extends Disposable {
74
98
  return this.provideContent();
75
99
  }
76
100
  }
101
+ let CommentsThreadWidgetAccessibleContentProvider = class CommentsThreadWidgetAccessibleContentProvider extends Disposable {
102
+ constructor(_commentService, _editorService, _uriIdentityService) {
103
+ super();
104
+ this._commentService = _commentService;
105
+ this._editorService = _editorService;
106
+ this._uriIdentityService = _uriIdentityService;
107
+ this.id = "commentThread" ;
108
+ this.verbositySettingKey = "accessibility.verbosity.comments" ;
109
+ this.options = { type: "view" };
110
+ }
111
+ get activeCommentInfo() {
112
+ if (!this._activeCommentInfo && this._commentService.lastActiveCommentcontroller) {
113
+ this._activeCommentInfo = this._commentService.lastActiveCommentcontroller.activeComment;
114
+ }
115
+ return this._activeCommentInfo;
116
+ }
117
+ provideContent() {
118
+ if (!this.activeCommentInfo) {
119
+ throw ( new Error('No current comment thread'));
120
+ }
121
+ const comment = this.activeCommentInfo.comment?.body;
122
+ const commentLabel = typeof comment === 'string' ? comment : comment?.value ?? '';
123
+ const resource = this.activeCommentInfo.thread.resource;
124
+ const range = this.activeCommentInfo.thread.range;
125
+ let contentLabel = '';
126
+ if (resource && range) {
127
+ const editor = this._editorService.findEditors(( URI.parse(resource))) || [];
128
+ const codeEditor = this._editorService.activeEditorPane?.getControl();
129
+ if (editor?.length && isCodeEditor(codeEditor)) {
130
+ const content = codeEditor.getModel()?.getValueInRange(range);
131
+ if (content) {
132
+ contentLabel = '\nCorresponding code: \n' + content;
133
+ }
134
+ }
135
+ }
136
+ return commentLabel + contentLabel;
137
+ }
138
+ onClose() {
139
+ const lastComment = this._activeCommentInfo;
140
+ this._activeCommentInfo = undefined;
141
+ if (lastComment) {
142
+ revealCommentThread(this._commentService, this._editorService, this._uriIdentityService, lastComment.thread, lastComment.comment);
143
+ }
144
+ }
145
+ provideNextContent() {
146
+ const newCommentInfo = moveToNextCommentInThread(this._activeCommentInfo, 'next');
147
+ if (newCommentInfo) {
148
+ this._activeCommentInfo = newCommentInfo;
149
+ return this.provideContent();
150
+ }
151
+ return undefined;
152
+ }
153
+ providePreviousContent() {
154
+ const newCommentInfo = moveToNextCommentInThread(this._activeCommentInfo, 'previous');
155
+ if (newCommentInfo) {
156
+ this._activeCommentInfo = newCommentInfo;
157
+ return this.provideContent();
158
+ }
159
+ return undefined;
160
+ }
161
+ };
162
+ CommentsThreadWidgetAccessibleContentProvider = ( __decorate([
163
+ ( __param(0, ICommentService)),
164
+ ( __param(1, IEditorService)),
165
+ ( __param(2, IUriIdentityService))
166
+ ], CommentsThreadWidgetAccessibleContentProvider));
77
167
 
78
- export { CommentsAccessibleView };
168
+ export { CommentThreadAccessibleView, CommentsAccessibleView };
@@ -1,15 +1,15 @@
1
- import { KeyMod, KeyCode, KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
1
+ import { KeyChord } from 'vscode/vscode/vs/base/common/keyCodes';
2
2
  import 'vscode/vscode/vs/workbench/contrib/comments/browser/media/review.css';
3
3
  import { isDiffEditor, isCodeEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
4
- import { registerEditorContribution, EditorContributionInstantiation } from 'vscode/vscode/vs/editor/browser/editorExtensions';
4
+ import { registerEditorContribution } from 'vscode/vscode/vs/editor/browser/editorExtensions';
5
5
  import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
6
6
  import { localize } from 'vscode/vscode/vs/nls';
7
7
  import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
8
- import { KeybindingsRegistry, KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
8
+ import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
9
9
  import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService.service';
10
10
  import { ctxCommentEditorFocused, SimpleCommentEditor } from 'vscode/vscode/vs/workbench/contrib/comments/browser/simpleCommentEditor';
11
11
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
12
- import { MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
12
+ import { registerAction2, Action2, MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
13
13
  import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
14
14
  import { ID, CommentController } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsController';
15
15
  import { Range } from 'vscode/vscode/vs/editor/common/core/range';
@@ -18,15 +18,14 @@ import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/
18
18
  import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
19
19
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
20
20
  import { accessibilityHelpIsShown, accessibleViewCurrentProviderId } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
21
- import { CommentCommandId } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentCommandIds';
22
- import { registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
21
+ import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
23
22
  import { CommentsInputContentProvider } from './commentsInputContentProvider.js';
24
- import { AccessibleViewProviderId } from 'vscode/vscode/vs/platform/accessibility/browser/accessibleView';
23
+ import { CommentWidgetFocus } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentThreadZoneWidget';
25
24
 
26
- registerEditorContribution(ID, CommentController, EditorContributionInstantiation.AfterFirstRender);
27
- registerWorkbenchContribution2(CommentsInputContentProvider.ID, CommentsInputContentProvider, WorkbenchPhase.BlockRestore);
25
+ registerEditorContribution(ID, CommentController, 1 );
26
+ registerWorkbenchContribution2(CommentsInputContentProvider.ID, CommentsInputContentProvider, 2 );
28
27
  KeybindingsRegistry.registerCommandAndKeybindingRule({
29
- id: CommentCommandId.NextThread,
28
+ id: "editor.action.nextCommentThreadAction" ,
30
29
  handler: async (accessor, args) => {
31
30
  const activeEditor = getActiveEditor(accessor);
32
31
  if (!activeEditor) {
@@ -36,13 +35,13 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
36
35
  if (!controller) {
37
36
  return Promise.resolve();
38
37
  }
39
- controller.nextCommentThread();
38
+ controller.nextCommentThread(true);
40
39
  },
41
- weight: KeybindingWeight.EditorContrib,
42
- primary: KeyMod.Alt | KeyCode.F9,
40
+ weight: 100 ,
41
+ primary: 512 | 67 ,
43
42
  });
44
43
  KeybindingsRegistry.registerCommandAndKeybindingRule({
45
- id: CommentCommandId.PreviousThread,
44
+ id: "editor.action.previousCommentThreadAction" ,
46
45
  handler: async (accessor, args) => {
47
46
  const activeEditor = getActiveEditor(accessor);
48
47
  if (!activeEditor) {
@@ -52,13 +51,77 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
52
51
  if (!controller) {
53
52
  return Promise.resolve();
54
53
  }
55
- controller.previousCommentThread();
54
+ controller.previousCommentThread(true);
56
55
  },
57
- weight: KeybindingWeight.EditorContrib,
58
- primary: KeyMod.Shift | KeyMod.Alt | KeyCode.F9
56
+ weight: 100 ,
57
+ primary: 1024 | 512 | 67
58
+ });
59
+ registerAction2(class extends Action2 {
60
+ constructor() {
61
+ super({
62
+ id: "editor.action.nextCommentedRangeAction" ,
63
+ title: {
64
+ value: ( localize(5327, "Go to Next Commented Range")),
65
+ original: 'Go to Next Commented Range'
66
+ },
67
+ category: {
68
+ value: ( localize(5328, "Comments")),
69
+ original: 'Comments'
70
+ },
71
+ f1: true,
72
+ keybinding: {
73
+ primary: 512 | 68 ,
74
+ weight: 100 ,
75
+ when: CommentContextKeys.activeEditorHasCommentingRange
76
+ }
77
+ });
78
+ }
79
+ run(accessor, ...args) {
80
+ const activeEditor = getActiveEditor(accessor);
81
+ if (!activeEditor) {
82
+ return;
83
+ }
84
+ const controller = CommentController.get(activeEditor);
85
+ if (!controller) {
86
+ return;
87
+ }
88
+ controller.nextCommentThread(false);
89
+ }
90
+ });
91
+ registerAction2(class extends Action2 {
92
+ constructor() {
93
+ super({
94
+ id: "editor.action.previousCommentedRangeAction" ,
95
+ title: {
96
+ value: ( localize(5329, "Go to Previous Commented Range")),
97
+ original: 'Go to Previous Commented Range'
98
+ },
99
+ category: {
100
+ value: ( localize(5328, "Comments")),
101
+ original: 'Comments'
102
+ },
103
+ f1: true,
104
+ keybinding: {
105
+ primary: 1024 | 512 | 68 ,
106
+ weight: 100 ,
107
+ when: CommentContextKeys.activeEditorHasCommentingRange
108
+ }
109
+ });
110
+ }
111
+ run(accessor, ...args) {
112
+ const activeEditor = getActiveEditor(accessor);
113
+ if (!activeEditor) {
114
+ return;
115
+ }
116
+ const controller = CommentController.get(activeEditor);
117
+ if (!controller) {
118
+ return;
119
+ }
120
+ controller.previousCommentThread(false);
121
+ }
59
122
  });
60
123
  KeybindingsRegistry.registerCommandAndKeybindingRule({
61
- id: CommentCommandId.NextRange,
124
+ id: "editor.action.nextCommentingRange" ,
62
125
  handler: async (accessor, args) => {
63
126
  const activeEditor = getActiveEditor(accessor);
64
127
  if (!activeEditor) {
@@ -75,22 +138,22 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
75
138
  CommentContextKeys.commentFocused,
76
139
  (ContextKeyExpr.and(
77
140
  accessibilityHelpIsShown,
78
- (accessibleViewCurrentProviderId.isEqualTo(AccessibleViewProviderId.Comments))
141
+ (accessibleViewCurrentProviderId.isEqualTo("comments" ))
79
142
  ))
80
143
  ))))),
81
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.DownArrow),
82
- weight: KeybindingWeight.EditorContrib
144
+ primary: KeyChord(2048 | 41 , 2048 | 512 | 18 ),
145
+ weight: 100
83
146
  });
84
147
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
85
148
  command: {
86
- id: CommentCommandId.NextRange,
87
- title: ( localize(5291, "Go to Next Commenting Range")),
149
+ id: "editor.action.nextCommentingRange" ,
150
+ title: ( localize(5330, "Go to Next Commenting Range")),
88
151
  category: 'Comments',
89
152
  },
90
153
  when: CommentContextKeys.activeEditorHasCommentingRange
91
154
  });
92
155
  KeybindingsRegistry.registerCommandAndKeybindingRule({
93
- id: CommentCommandId.PreviousRange,
156
+ id: "editor.action.previousCommentingRange" ,
94
157
  handler: async (accessor, args) => {
95
158
  const activeEditor = getActiveEditor(accessor);
96
159
  if (!activeEditor) {
@@ -107,22 +170,22 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
107
170
  CommentContextKeys.commentFocused,
108
171
  (ContextKeyExpr.and(
109
172
  accessibilityHelpIsShown,
110
- (accessibleViewCurrentProviderId.isEqualTo(AccessibleViewProviderId.Comments))
173
+ (accessibleViewCurrentProviderId.isEqualTo("comments" ))
111
174
  ))
112
175
  ))))),
113
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.UpArrow),
114
- weight: KeybindingWeight.EditorContrib
176
+ primary: KeyChord(2048 | 41 , 2048 | 512 | 16 ),
177
+ weight: 100
115
178
  });
116
179
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
117
180
  command: {
118
- id: CommentCommandId.PreviousRange,
119
- title: ( localize(5292, "Go to Previous Commenting Range")),
181
+ id: "editor.action.previousCommentingRange" ,
182
+ title: ( localize(5331, "Go to Previous Commenting Range")),
120
183
  category: 'Comments',
121
184
  },
122
185
  when: CommentContextKeys.activeEditorHasCommentingRange
123
186
  });
124
187
  CommandsRegistry.registerCommand({
125
- id: CommentCommandId.ToggleCommenting,
188
+ id: "workbench.action.toggleCommenting" ,
126
189
  handler: (accessor) => {
127
190
  const commentService = accessor.get(ICommentService);
128
191
  const enable = commentService.isCommentingEnabled;
@@ -131,14 +194,14 @@ CommandsRegistry.registerCommand({
131
194
  });
132
195
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
133
196
  command: {
134
- id: CommentCommandId.ToggleCommenting,
135
- title: ( localize(5293, "Toggle Editor Commenting")),
197
+ id: "workbench.action.toggleCommenting" ,
198
+ title: ( localize(5332, "Toggle Editor Commenting")),
136
199
  category: 'Comments',
137
200
  },
138
201
  when: CommentContextKeys.WorkspaceHasCommenting
139
202
  });
140
203
  KeybindingsRegistry.registerCommandAndKeybindingRule({
141
- id: CommentCommandId.Add,
204
+ id: "workbench.action.addComment" ,
142
205
  handler: async (accessor, args) => {
143
206
  const activeEditor = getActiveEditor(accessor);
144
207
  if (!activeEditor) {
@@ -160,66 +223,111 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
160
223
  await controller.addOrToggleCommentAtLine(position, undefined);
161
224
  }
162
225
  catch (e) {
163
- notificationService.error(( localize(5294, "The cursor must be within a commenting range to add a comment")));
226
+ notificationService.error(( localize(5333, "The cursor must be within a commenting range to add a comment")));
164
227
  }
165
228
  },
166
- weight: KeybindingWeight.EditorContrib,
167
- primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC),
229
+ weight: 100 ,
230
+ primary: KeyChord(2048 | 41 , 2048 | 512 | 33 ),
168
231
  });
169
232
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
170
233
  command: {
171
- id: CommentCommandId.Add,
172
- title: ( localize(5295, "Add Comment on Current Selection")),
234
+ id: "workbench.action.addComment" ,
235
+ title: ( localize(5334, "Add Comment on Current Selection")),
173
236
  category: 'Comments'
174
237
  },
175
238
  when: CommentContextKeys.activeCursorHasCommentingRange
176
239
  });
240
+ registerAction2(class extends Action2 {
241
+ constructor() {
242
+ super({
243
+ id: "workbench.action.focusCommentOnCurrentLine" ,
244
+ title: {
245
+ value: ( localize(5335, "Focus Comment on Current Line")),
246
+ original: 'Focus Comment on Current Line'
247
+ },
248
+ category: {
249
+ value: ( localize(5328, "Comments")),
250
+ original: 'Comments'
251
+ },
252
+ f1: true,
253
+ precondition: CommentContextKeys.activeCursorHasComment,
254
+ });
255
+ }
256
+ async run(accessor, ...args) {
257
+ const activeEditor = getActiveEditor(accessor);
258
+ if (!activeEditor) {
259
+ return;
260
+ }
261
+ const controller = CommentController.get(activeEditor);
262
+ if (!controller) {
263
+ return;
264
+ }
265
+ const position = activeEditor.getSelection();
266
+ const notificationService = accessor.get(INotificationService);
267
+ let error = false;
268
+ try {
269
+ const commentAtLine = controller.getCommentsAtLine(position);
270
+ if (commentAtLine.length === 0) {
271
+ error = true;
272
+ }
273
+ else {
274
+ await controller.revealCommentThread(commentAtLine[0].commentThread.threadId, undefined, false, CommentWidgetFocus.Widget);
275
+ }
276
+ }
277
+ catch (e) {
278
+ error = true;
279
+ }
280
+ if (error) {
281
+ notificationService.error(( localize(5336, "The cursor must be on a line with a comment to focus the comment")));
282
+ }
283
+ }
284
+ });
177
285
  CommandsRegistry.registerCommand({
178
- id: CommentCommandId.CollapseAll,
286
+ id: "workbench.action.collapseAllComments" ,
179
287
  handler: (accessor) => {
180
288
  return getActiveController(accessor)?.collapseAll();
181
289
  }
182
290
  });
183
291
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
184
292
  command: {
185
- id: CommentCommandId.CollapseAll,
186
- title: ( localize(5296, "Collapse All Comments")),
293
+ id: "workbench.action.collapseAllComments" ,
294
+ title: ( localize(5337, "Collapse All Comments")),
187
295
  category: 'Comments'
188
296
  },
189
297
  when: CommentContextKeys.WorkspaceHasCommenting
190
298
  });
191
299
  CommandsRegistry.registerCommand({
192
- id: CommentCommandId.ExpandAll,
300
+ id: "workbench.action.expandAllComments" ,
193
301
  handler: (accessor) => {
194
302
  return getActiveController(accessor)?.expandAll();
195
303
  }
196
304
  });
197
305
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
198
306
  command: {
199
- id: CommentCommandId.ExpandAll,
200
- title: ( localize(5297, "Expand All Comments")),
307
+ id: "workbench.action.expandAllComments" ,
308
+ title: ( localize(5338, "Expand All Comments")),
201
309
  category: 'Comments'
202
310
  },
203
311
  when: CommentContextKeys.WorkspaceHasCommenting
204
312
  });
205
313
  CommandsRegistry.registerCommand({
206
- id: CommentCommandId.ExpandUnresolved,
314
+ id: "workbench.action.expandUnresolvedComments" ,
207
315
  handler: (accessor) => {
208
316
  return getActiveController(accessor)?.expandUnresolved();
209
317
  }
210
318
  });
211
319
  MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
212
320
  command: {
213
- id: CommentCommandId.ExpandUnresolved,
214
- title: ( localize(5298, "Expand Unresolved Comments")),
321
+ id: "workbench.action.expandUnresolvedComments" ,
322
+ title: ( localize(5339, "Expand Unresolved Comments")),
215
323
  category: 'Comments'
216
324
  },
217
325
  when: CommentContextKeys.WorkspaceHasCommenting
218
326
  });
219
327
  KeybindingsRegistry.registerCommandAndKeybindingRule({
220
- id: CommentCommandId.Submit,
221
- weight: KeybindingWeight.EditorContrib,
222
- primary: KeyMod.CtrlCmd | KeyCode.Enter,
328
+ id: "editor.action.submitComment" ,
329
+ weight: 100 ,
330
+ primary: 2048 | 3 ,
223
331
  when: ctxCommentEditorFocused,
224
332
  handler: (accessor, args) => {
225
333
  const activeCodeEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
@@ -229,10 +337,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
229
337
  }
230
338
  });
231
339
  KeybindingsRegistry.registerCommandAndKeybindingRule({
232
- id: CommentCommandId.Hide,
233
- weight: KeybindingWeight.EditorContrib,
234
- primary: KeyCode.Escape,
235
- secondary: [KeyMod.Shift | KeyCode.Escape],
340
+ id: "workbench.action.hideComment" ,
341
+ weight: 100 ,
342
+ primary: 9 ,
343
+ secondary: [1024 | 9 ],
236
344
  when: ctxCommentEditorFocused,
237
345
  handler: (accessor, args) => {
238
346
  const activeCodeEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
@@ -2,7 +2,6 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
3
  import { Schemas } from 'vscode/vscode/vs/base/common/network';
4
4
  import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
5
- import { ScrollType } from 'vscode/vscode/vs/editor/common/editorCommon';
6
5
  import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
7
6
  import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
8
7
  import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
@@ -24,7 +23,7 @@ let CommentsInputContentProvider = class CommentsInputContentProvider extends Di
24
23
  return null;
25
24
  }
26
25
  if (input.options) {
27
- applyTextEditorOptions(input.options, editor, ScrollType.Immediate);
26
+ applyTextEditorOptions(input.options, editor, 1 );
28
27
  }
29
28
  return editor;
30
29
  }));