@codingame/monaco-vscode-extensions-service-override 1.85.0 → 1.85.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/extensions.js +3 -3
  2. package/package.json +3 -3
  3. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +3 -3
  4. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +1 -1
  5. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +3 -3
  6. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
  7. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +8 -8
  8. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +1 -1
  9. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +2 -2
  10. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +3 -3
  11. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +2 -2
  12. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +1 -1
  13. package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -3
  14. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +0 -40
  15. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +0 -141
  16. package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +0 -37
  17. package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +0 -342
  18. package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +0 -1197
  19. package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +0 -117
  20. package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +0 -83
  21. package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +0 -543
  22. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +0 -6
  23. package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +0 -292
  24. package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +0 -169
  25. package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +0 -6
  26. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -255
  27. package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +0 -195
  28. package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +0 -260
  29. package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -5
  30. package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +0 -26
  31. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -63
  32. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -51
  33. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -649
  34. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -302
  35. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -62
  36. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -251
  37. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -109
  38. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -335
  39. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -6
  40. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -101
  41. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -57
  42. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -3
  43. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -144
  44. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -482
  45. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -6
  46. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -92
  47. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -56
  48. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -110
  49. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -260
  50. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -616
  51. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -309
  52. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -38
  53. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -167
  54. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -80
  55. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -70
  56. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -3
  57. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -108
  58. package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +0 -506
  59. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +0 -132
  60. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -79
@@ -1,649 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import * as nls from 'monaco-editor/esm/vs/nls.js';
3
- import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
4
- import * as languages from 'monaco-editor/esm/vs/editor/common/languages.js';
5
- import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
6
- import { Action, Separator, ActionRunner } from 'monaco-editor/esm/vs/base/common/actions.js';
7
- import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
8
- import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
9
- import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
10
- import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
11
- import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
12
- import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
13
- import { MIN_EDITOR_HEIGHT, SimpleCommentEditor, calculateEditorHeight } from 'vscode/vscode/vs/workbench/contrib/comments/browser/simpleCommentEditor';
14
- import { Selection } from 'monaco-editor/esm/vs/editor/common/core/selection.js';
15
- import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
16
- import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
17
- import { ToolBar } from 'monaco-editor/esm/vs/base/browser/ui/toolbar/toolbar.js';
18
- import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
19
- import { ToggleReactionsAction, ReactionAction, ReactionActionViewItem } from './reactionsAction.js';
20
- import { MenuItemAction, SubmenuItemAction, MenuId } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
21
- import { MenuEntryActionViewItem, SubmenuEntryActionViewItem } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
22
- import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
23
- import { CommentFormActions } from './commentFormActions.js';
24
- import { MOUSE_CURSOR_TEXT_CSS_CLASS_NAME } from 'monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js';
25
- import { ActionViewItem } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js';
26
- import { DropdownMenuActionViewItem } from 'monaco-editor/esm/vs/base/browser/ui/dropdown/dropdownActionViewItem.js';
27
- import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
28
- import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
29
- import { TimestampWidget } from './timestamp.js';
30
- import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
31
- import { Scrollable } from 'monaco-editor/esm/vs/base/common/scrollable.js';
32
- import { SmoothScrollableElement } from 'monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js';
33
- import { DomEmitter } from 'monaco-editor/esm/vs/base/browser/event.js';
34
- import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
35
- import { FileAccess } from 'monaco-editor/esm/vs/base/common/network.js';
36
- import { COMMENTS_SECTION } from '../common/commentsConfiguration.js';
37
- import { StandardMouseEvent } from 'monaco-editor/esm/vs/base/browser/mouseEvent.js';
38
- import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
39
-
40
- class CommentsActionRunner extends ActionRunner {
41
- async runAction(action, context) {
42
- await action.run(...context);
43
- }
44
- }
45
- let CommentNode = class CommentNode extends Disposable {
46
- get domNode() {
47
- return this._domNode;
48
- }
49
- constructor(parentEditor, commentThread, comment, pendingEdit, owner, resource, parentThread, markdownRenderer, instantiationService, commentService, modelService, languageService, notificationService, contextMenuService, contextKeyService, configurationService, accessibilityService) {
50
- super();
51
- this.parentEditor = parentEditor;
52
- this.commentThread = commentThread;
53
- this.comment = comment;
54
- this.pendingEdit = pendingEdit;
55
- this.owner = owner;
56
- this.resource = resource;
57
- this.parentThread = parentThread;
58
- this.markdownRenderer = markdownRenderer;
59
- this.instantiationService = instantiationService;
60
- this.commentService = commentService;
61
- this.modelService = modelService;
62
- this.languageService = languageService;
63
- this.notificationService = notificationService;
64
- this.contextMenuService = contextMenuService;
65
- this.configurationService = configurationService;
66
- this.accessibilityService = accessibilityService;
67
- this._editAction = null;
68
- this._commentEditContainer = null;
69
- this._commentEditor = null;
70
- this._commentEditorDisposables = [];
71
- this._commentEditorModel = null;
72
- this._editorHeight = MIN_EDITOR_HEIGHT;
73
- this._commentFormActions = null;
74
- this._commentEditorActions = null;
75
- this._onDidClick = ( new Emitter());
76
- this.isEditing = false;
77
- this._domNode = dom.$('div.review-comment');
78
- this._contextKeyService = contextKeyService.createScoped(this._domNode);
79
- this._commentContextValue = CommentContextKeys.commentContext.bindTo(this._contextKeyService);
80
- if (this.comment.contextValue) {
81
- this._commentContextValue.set(this.comment.contextValue);
82
- }
83
- this._commentMenus = this.commentService.getCommentMenus(this.owner);
84
- this._domNode.tabIndex = -1;
85
- const avatar = dom.append(this._domNode, dom.$('div.avatar-container'));
86
- if (comment.userIconPath) {
87
- const img = dom.append(avatar, dom.$('img.avatar'));
88
- img.src = ( FileAccess.uriToBrowserUri(URI.revive(comment.userIconPath)).toString(true));
89
- img.onerror = _ => img.remove();
90
- }
91
- this._commentDetailsContainer = dom.append(this._domNode, dom.$('.review-comment-contents'));
92
- this.createHeader(this._commentDetailsContainer);
93
- this._body = document.createElement(`div`);
94
- this._body.classList.add('comment-body', MOUSE_CURSOR_TEXT_CSS_CLASS_NAME);
95
- if (configurationService.getValue(COMMENTS_SECTION)?.maxHeight !== false) {
96
- this._body.classList.add('comment-body-max-height');
97
- }
98
- this.createScroll(this._commentDetailsContainer, this._body);
99
- this.updateCommentBody(this.comment.body);
100
- if (this.comment.commentReactions && this.comment.commentReactions.length && this.comment.commentReactions.filter(reaction => !!reaction.count).length) {
101
- this.createReactionsContainer(this._commentDetailsContainer);
102
- }
103
- this._domNode.setAttribute('aria-label', `${comment.userName}, ${this.commentBodyValue}`);
104
- this._domNode.setAttribute('role', 'treeitem');
105
- this._clearTimeout = null;
106
- this._register(dom.addDisposableListener(this._domNode, dom.EventType.CLICK, () => this.isEditing || this._onDidClick.fire(this)));
107
- this._register(dom.addDisposableListener(this._domNode, dom.EventType.CONTEXT_MENU, e => {
108
- return this.onContextMenu(e);
109
- }));
110
- if (pendingEdit) {
111
- this.switchToEditMode();
112
- }
113
- this._register(this.accessibilityService.onDidChangeScreenReaderOptimized(() => {
114
- this.toggleToolbarHidden(true);
115
- }));
116
- }
117
- createScroll(container, body) {
118
- this._scrollable = ( new Scrollable({
119
- forceIntegerValues: true,
120
- smoothScrollDuration: 125,
121
- scheduleAtNextAnimationFrame: cb => dom.scheduleAtNextAnimationFrame(dom.getWindow(container), cb)
122
- }));
123
- this._scrollableElement = this._register(( new SmoothScrollableElement(body, {
124
- horizontal: 3 ,
125
- vertical: 3
126
- }, this._scrollable)));
127
- this._register(this._scrollableElement.onScroll(e => {
128
- if (e.scrollLeftChanged) {
129
- body.scrollLeft = e.scrollLeft;
130
- }
131
- if (e.scrollTopChanged) {
132
- body.scrollTop = e.scrollTop;
133
- }
134
- }));
135
- const onDidScrollViewContainer = this._register(( new DomEmitter(body, 'scroll'))).event;
136
- this._register(onDidScrollViewContainer(_ => {
137
- const position = this._scrollableElement.getScrollPosition();
138
- const scrollLeft = Math.abs(body.scrollLeft - position.scrollLeft) <= 1 ? undefined : body.scrollLeft;
139
- const scrollTop = Math.abs(body.scrollTop - position.scrollTop) <= 1 ? undefined : body.scrollTop;
140
- if (scrollLeft !== undefined || scrollTop !== undefined) {
141
- this._scrollableElement.setScrollPosition({ scrollLeft, scrollTop });
142
- }
143
- }));
144
- container.appendChild(this._scrollableElement.getDomNode());
145
- }
146
- updateCommentBody(body) {
147
- this._body.innerText = '';
148
- this._md = undefined;
149
- this._plainText = undefined;
150
- if (typeof body === 'string') {
151
- this._plainText = dom.append(this._body, dom.$('.comment-body-plainstring'));
152
- this._plainText.innerText = body;
153
- }
154
- else {
155
- this._md = this.markdownRenderer.render(body).element;
156
- this._body.appendChild(this._md);
157
- }
158
- }
159
- get onDidClick() {
160
- return this._onDidClick.event;
161
- }
162
- createTimestamp(container) {
163
- this._timestamp = dom.append(container, dom.$('span.timestamp-container'));
164
- this.updateTimestamp(this.comment.timestamp);
165
- }
166
- updateTimestamp(raw) {
167
- if (!this._timestamp) {
168
- return;
169
- }
170
- const timestamp = raw !== undefined ? ( new Date(raw)) : undefined;
171
- if (!timestamp) {
172
- this._timestampWidget?.dispose();
173
- }
174
- else {
175
- if (!this._timestampWidget) {
176
- this._timestampWidget = ( new TimestampWidget(this.configurationService, this._timestamp, timestamp));
177
- this._register(this._timestampWidget);
178
- }
179
- else {
180
- this._timestampWidget.setTimestamp(timestamp);
181
- }
182
- }
183
- }
184
- createHeader(commentDetailsContainer) {
185
- const header = dom.append(commentDetailsContainer, dom.$(`div.comment-title.${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`));
186
- const infoContainer = dom.append(header, dom.$('comment-header-info'));
187
- const author = dom.append(infoContainer, dom.$('strong.author'));
188
- author.innerText = this.comment.userName;
189
- this.createTimestamp(infoContainer);
190
- this._isPendingLabel = dom.append(infoContainer, dom.$('span.isPending'));
191
- if (this.comment.label) {
192
- this._isPendingLabel.innerText = this.comment.label;
193
- }
194
- else {
195
- this._isPendingLabel.innerText = '';
196
- }
197
- this._actionsToolbarContainer = dom.append(header, dom.$('.comment-actions'));
198
- this.toggleToolbarHidden(true);
199
- this.createActionsToolbar();
200
- }
201
- toggleToolbarHidden(hidden) {
202
- if (hidden && !this.accessibilityService.isScreenReaderOptimized()) {
203
- this._actionsToolbarContainer.classList.add('hidden');
204
- }
205
- else {
206
- this._actionsToolbarContainer.classList.remove('hidden');
207
- }
208
- }
209
- getToolbarActions(menu) {
210
- const contributedActions = menu.getActions({ shouldForwardArgs: true });
211
- const primary = [];
212
- const secondary = [];
213
- const result = { primary, secondary };
214
- fillInActions(contributedActions, result, false, g => /^inline/.test(g));
215
- return result;
216
- }
217
- get commentNodeContext() {
218
- return [{
219
- thread: this.commentThread,
220
- commentUniqueId: this.comment.uniqueIdInThread,
221
- $mid: 10
222
- },
223
- {
224
- commentControlHandle: this.commentThread.controllerHandle,
225
- commentThreadHandle: this.commentThread.commentThreadHandle,
226
- $mid: 7
227
- }];
228
- }
229
- createToolbar() {
230
- this.toolbar = ( new ToolBar(this._actionsToolbarContainer, this.contextMenuService, {
231
- actionViewItemProvider: action => {
232
- if (action.id === ToggleReactionsAction.ID) {
233
- return ( new DropdownMenuActionViewItem(action, action.menuActions, this.contextMenuService, {
234
- actionViewItemProvider: action => this.actionViewItemProvider(action),
235
- actionRunner: this.actionRunner,
236
- classNames: ['toolbar-toggle-pickReactions', ...ThemeIcon.asClassNameArray(Codicon.reactions)],
237
- anchorAlignmentProvider: () => 1
238
- }));
239
- }
240
- return this.actionViewItemProvider(action);
241
- },
242
- orientation: 0
243
- }));
244
- this.toolbar.context = this.commentNodeContext;
245
- this.toolbar.actionRunner = ( new CommentsActionRunner());
246
- this.registerActionBarListeners(this._actionsToolbarContainer);
247
- this._register(this.toolbar);
248
- }
249
- createActionsToolbar() {
250
- const actions = [];
251
- const hasReactionHandler = this.commentService.hasReactionHandler(this.owner);
252
- if (hasReactionHandler) {
253
- const toggleReactionAction = this.createReactionPicker(this.comment.commentReactions || []);
254
- actions.push(toggleReactionAction);
255
- }
256
- const menu = this._commentMenus.getCommentTitleActions(this.comment, this._contextKeyService);
257
- this._register(menu);
258
- this._register(menu.onDidChange(e => {
259
- const { primary, secondary } = this.getToolbarActions(menu);
260
- if (!this.toolbar && (primary.length || secondary.length)) {
261
- this.createToolbar();
262
- }
263
- this.toolbar.setActions(primary, secondary);
264
- }));
265
- const { primary, secondary } = this.getToolbarActions(menu);
266
- actions.push(...primary);
267
- if (actions.length || secondary.length) {
268
- this.createToolbar();
269
- this.toolbar.setActions(actions, secondary);
270
- }
271
- }
272
- actionViewItemProvider(action) {
273
- let options = {};
274
- if (action.id === ToggleReactionsAction.ID) {
275
- options = { label: false, icon: true };
276
- }
277
- else {
278
- options = { label: false, icon: true };
279
- }
280
- if (action.id === ReactionAction.ID) {
281
- const item = ( new ReactionActionViewItem(action));
282
- return item;
283
- }
284
- else if (action instanceof MenuItemAction) {
285
- return this.instantiationService.createInstance(MenuEntryActionViewItem, action, undefined);
286
- }
287
- else if (action instanceof SubmenuItemAction) {
288
- return this.instantiationService.createInstance(SubmenuEntryActionViewItem, action, undefined);
289
- }
290
- else {
291
- const item = ( new ActionViewItem({}, action, options));
292
- return item;
293
- }
294
- }
295
- async submitComment() {
296
- if (this._commentEditor && this._commentFormActions) {
297
- await this._commentFormActions.triggerDefaultAction();
298
- this.pendingEdit = undefined;
299
- }
300
- }
301
- createReactionPicker(reactionGroup) {
302
- const toggleReactionAction = this._register(( new ToggleReactionsAction(() => {
303
- toggleReactionActionViewItem?.show();
304
- }, ( nls.localizeWithPath(
305
- 'vs/workbench/contrib/comments/browser/commentNode',
306
- 'commentToggleReaction',
307
- "Toggle Reaction"
308
- )))));
309
- let reactionMenuActions = [];
310
- if (reactionGroup && reactionGroup.length) {
311
- reactionMenuActions = ( reactionGroup.map((reaction) => {
312
- return ( new Action(
313
- `reaction.command.${reaction.label}`,
314
- `${reaction.label}`,
315
- '',
316
- true,
317
- async () => {
318
- try {
319
- await this.commentService.toggleReaction(this.owner, this.resource, this.commentThread, this.comment, reaction);
320
- }
321
- catch (e) {
322
- const error = e.message
323
- ? ( nls.localizeWithPath(
324
- 'vs/workbench/contrib/comments/browser/commentNode',
325
- 'commentToggleReactionError',
326
- "Toggling the comment reaction failed: {0}.",
327
- e.message
328
- ))
329
- : ( nls.localizeWithPath(
330
- 'vs/workbench/contrib/comments/browser/commentNode',
331
- 'commentToggleReactionDefaultError',
332
- "Toggling the comment reaction failed"
333
- ));
334
- this.notificationService.error(error);
335
- }
336
- }
337
- ));
338
- }));
339
- }
340
- toggleReactionAction.menuActions = reactionMenuActions;
341
- const toggleReactionActionViewItem = ( new DropdownMenuActionViewItem(
342
- toggleReactionAction,
343
- toggleReactionAction.menuActions,
344
- this.contextMenuService,
345
- {
346
- actionViewItemProvider: action => {
347
- if (action.id === ToggleReactionsAction.ID) {
348
- return toggleReactionActionViewItem;
349
- }
350
- return this.actionViewItemProvider(action);
351
- },
352
- actionRunner: this.actionRunner,
353
- classNames: 'toolbar-toggle-pickReactions',
354
- anchorAlignmentProvider: () => 1
355
- }
356
- ));
357
- return toggleReactionAction;
358
- }
359
- createReactionsContainer(commentDetailsContainer) {
360
- this._reactionActionsContainer = dom.append(commentDetailsContainer, dom.$('div.comment-reactions'));
361
- this._reactionsActionBar = ( new ActionBar(this._reactionActionsContainer, {
362
- actionViewItemProvider: action => {
363
- if (action.id === ToggleReactionsAction.ID) {
364
- return ( new DropdownMenuActionViewItem(action, action.menuActions, this.contextMenuService, {
365
- actionViewItemProvider: action => this.actionViewItemProvider(action),
366
- actionRunner: this.actionRunner,
367
- classNames: ['toolbar-toggle-pickReactions', ...ThemeIcon.asClassNameArray(Codicon.reactions)],
368
- anchorAlignmentProvider: () => 1
369
- }));
370
- }
371
- return this.actionViewItemProvider(action);
372
- }
373
- }));
374
- this._register(this._reactionsActionBar);
375
- const hasReactionHandler = this.commentService.hasReactionHandler(this.owner);
376
- if (hasReactionHandler) {
377
- const toggleReactionAction = this.createReactionPicker(this.comment.commentReactions || []);
378
- this._reactionsActionBar.push(toggleReactionAction, { label: false, icon: true });
379
- }
380
- }
381
- get commentBodyValue() {
382
- return (typeof this.comment.body === 'string') ? this.comment.body : this.comment.body.value;
383
- }
384
- createCommentEditor(editContainer) {
385
- const container = dom.append(editContainer, dom.$('.edit-textarea'));
386
- this._commentEditor = this.instantiationService.createInstance(SimpleCommentEditor, container, SimpleCommentEditor.getEditorOptions(this.configurationService), this._contextKeyService, this.parentThread);
387
- const resource = ( URI.parse(`comment:commentinput-${this.comment.uniqueIdInThread}-${Date.now()}.md`));
388
- this._commentEditorModel = this.modelService.createModel('', this.languageService.createByFilepathOrFirstLine(resource), resource, false);
389
- this._commentEditor.setModel(this._commentEditorModel);
390
- this._commentEditor.setValue(this.pendingEdit ?? this.commentBodyValue);
391
- this.pendingEdit = undefined;
392
- this._commentEditor.layout({ width: container.clientWidth - 14, height: this._editorHeight });
393
- this._commentEditor.focus();
394
- dom.scheduleAtNextAnimationFrame(dom.getWindow(editContainer), () => {
395
- this._commentEditor.layout({ width: container.clientWidth - 14, height: this._editorHeight });
396
- this._commentEditor.focus();
397
- });
398
- const lastLine = this._commentEditorModel.getLineCount();
399
- const lastColumn = this._commentEditorModel.getLineLength(lastLine) + 1;
400
- this._commentEditor.setSelection(( new Selection(lastLine, lastColumn, lastLine, lastColumn)));
401
- const commentThread = this.commentThread;
402
- commentThread.input = {
403
- uri: this._commentEditor.getModel().uri,
404
- value: this.commentBodyValue
405
- };
406
- this.commentService.setActiveCommentThread(commentThread);
407
- this._commentEditorDisposables.push(this._commentEditor.onDidFocusEditorWidget(() => {
408
- commentThread.input = {
409
- uri: this._commentEditor.getModel().uri,
410
- value: this.commentBodyValue
411
- };
412
- this.commentService.setActiveCommentThread(commentThread);
413
- }));
414
- this._commentEditorDisposables.push(this._commentEditor.onDidChangeModelContent(e => {
415
- if (commentThread.input && this._commentEditor && this._commentEditor.getModel().uri === commentThread.input.uri) {
416
- const newVal = this._commentEditor.getValue();
417
- if (newVal !== commentThread.input.value) {
418
- const input = commentThread.input;
419
- input.value = newVal;
420
- commentThread.input = input;
421
- this.commentService.setActiveCommentThread(commentThread);
422
- }
423
- }
424
- }));
425
- this.calculateEditorHeight();
426
- this._register((this._commentEditorModel.onDidChangeContent(() => {
427
- if (this._commentEditor && this.calculateEditorHeight()) {
428
- this._commentEditor.layout({ height: this._editorHeight, width: this._commentEditor.getLayoutInfo().width });
429
- this._commentEditor.render(true);
430
- }
431
- })));
432
- this._register(this._commentEditor);
433
- this._register(this._commentEditorModel);
434
- }
435
- calculateEditorHeight() {
436
- if (this._commentEditor) {
437
- const newEditorHeight = calculateEditorHeight(this.parentEditor, this._commentEditor, this._editorHeight);
438
- if (newEditorHeight !== this._editorHeight) {
439
- this._editorHeight = newEditorHeight;
440
- return true;
441
- }
442
- }
443
- return false;
444
- }
445
- getPendingEdit() {
446
- const model = this._commentEditor?.getModel();
447
- if (model && model.getValueLength() > 0) {
448
- return model.getValue();
449
- }
450
- return undefined;
451
- }
452
- removeCommentEditor() {
453
- this.isEditing = false;
454
- if (this._editAction) {
455
- this._editAction.enabled = true;
456
- }
457
- this._body.classList.remove('hidden');
458
- this._commentEditorModel?.dispose();
459
- this._commentEditorDisposables.forEach(dispose => dispose.dispose());
460
- this._commentEditorDisposables = [];
461
- if (this._commentEditor) {
462
- this._commentEditor.dispose();
463
- this._commentEditor = null;
464
- }
465
- this._commentEditContainer.remove();
466
- }
467
- layout(widthInPixel) {
468
- const editorWidth = widthInPixel !== undefined ? widthInPixel - 72 : (this._commentEditor?.getLayoutInfo().width ?? 0);
469
- this._commentEditor?.layout({ width: editorWidth, height: this._editorHeight });
470
- const scrollWidth = this._body.scrollWidth;
471
- const width = dom.getContentWidth(this._body);
472
- const scrollHeight = this._body.scrollHeight;
473
- const height = dom.getContentHeight(this._body) + 4;
474
- this._scrollableElement.setScrollDimensions({ width, scrollWidth, height, scrollHeight });
475
- }
476
- switchToEditMode() {
477
- if (this.isEditing) {
478
- return;
479
- }
480
- this.isEditing = true;
481
- this._body.classList.add('hidden');
482
- this._commentEditContainer = dom.append(this._commentDetailsContainer, dom.$('.edit-container'));
483
- this.createCommentEditor(this._commentEditContainer);
484
- const formActions = dom.append(this._commentEditContainer, dom.$('.form-actions'));
485
- const otherActions = dom.append(formActions, dom.$('.other-actions'));
486
- this.createCommentWidgetFormActions(otherActions);
487
- const editorActions = dom.append(formActions, dom.$('.editor-actions'));
488
- this.createCommentWidgetEditorActions(editorActions);
489
- }
490
- createCommentWidgetFormActions(container) {
491
- const menus = this.commentService.getCommentMenus(this.owner);
492
- const menu = menus.getCommentActions(this.comment, this._contextKeyService);
493
- this._register(menu);
494
- this._register(menu.onDidChange(() => {
495
- this._commentFormActions?.setActions(menu);
496
- }));
497
- this._commentFormActions = ( new CommentFormActions(container, (action) => {
498
- const text = this._commentEditor.getValue();
499
- action.run({
500
- thread: this.commentThread,
501
- commentUniqueId: this.comment.uniqueIdInThread,
502
- text: text,
503
- $mid: 11
504
- });
505
- this.removeCommentEditor();
506
- }));
507
- this._register(this._commentFormActions);
508
- this._commentFormActions.setActions(menu);
509
- }
510
- createCommentWidgetEditorActions(container) {
511
- const menus = this.commentService.getCommentMenus(this.owner);
512
- const menu = menus.getCommentEditorActions(this._contextKeyService);
513
- this._register(menu);
514
- this._register(menu.onDidChange(() => {
515
- this._commentEditorActions?.setActions(menu);
516
- }));
517
- this._commentEditorActions = ( new CommentFormActions(container, (action) => {
518
- const text = this._commentEditor.getValue();
519
- action.run({
520
- thread: this.commentThread,
521
- commentUniqueId: this.comment.uniqueIdInThread,
522
- text: text,
523
- $mid: 11
524
- });
525
- this._commentEditor?.focus();
526
- }));
527
- this._register(this._commentEditorActions);
528
- this._commentEditorActions.setActions(menu, true);
529
- }
530
- setFocus(focused, visible = false) {
531
- if (focused) {
532
- this._domNode.focus();
533
- this.toggleToolbarHidden(false);
534
- this._actionsToolbarContainer.classList.add('tabfocused');
535
- this._domNode.tabIndex = 0;
536
- if (this.comment.mode === languages.CommentMode.Editing) {
537
- this._commentEditor?.focus();
538
- }
539
- }
540
- else {
541
- if (this._actionsToolbarContainer.classList.contains('tabfocused') && !this._actionsToolbarContainer.classList.contains('mouseover')) {
542
- this.toggleToolbarHidden(true);
543
- this._domNode.tabIndex = -1;
544
- }
545
- this._actionsToolbarContainer.classList.remove('tabfocused');
546
- }
547
- }
548
- registerActionBarListeners(actionsContainer) {
549
- this._register(dom.addDisposableListener(this._domNode, 'mouseenter', () => {
550
- this.toggleToolbarHidden(false);
551
- actionsContainer.classList.add('mouseover');
552
- }));
553
- this._register(dom.addDisposableListener(this._domNode, 'mouseleave', () => {
554
- if (actionsContainer.classList.contains('mouseover') && !actionsContainer.classList.contains('tabfocused')) {
555
- this.toggleToolbarHidden(true);
556
- }
557
- actionsContainer.classList.remove('mouseover');
558
- }));
559
- }
560
- update(newComment) {
561
- if (newComment.body !== this.comment.body) {
562
- this.updateCommentBody(newComment.body);
563
- }
564
- const isChangingMode = newComment.mode !== undefined && newComment.mode !== this.comment.mode;
565
- this.comment = newComment;
566
- if (isChangingMode) {
567
- if (newComment.mode === languages.CommentMode.Editing) {
568
- this.switchToEditMode();
569
- }
570
- else {
571
- this.removeCommentEditor();
572
- }
573
- }
574
- if (newComment.label) {
575
- this._isPendingLabel.innerText = newComment.label;
576
- }
577
- else {
578
- this._isPendingLabel.innerText = '';
579
- }
580
- this._reactionActionsContainer?.remove();
581
- this._reactionsActionBar?.clear();
582
- if (this.comment.commentReactions && ( this.comment.commentReactions.some(reaction => !!reaction.count))) {
583
- this.createReactionsContainer(this._commentDetailsContainer);
584
- }
585
- if (this.comment.contextValue) {
586
- this._commentContextValue.set(this.comment.contextValue);
587
- }
588
- else {
589
- this._commentContextValue.reset();
590
- }
591
- if (this.comment.timestamp) {
592
- this.updateTimestamp(this.comment.timestamp);
593
- }
594
- }
595
- onContextMenu(e) {
596
- const event = ( new StandardMouseEvent(dom.getWindow(this._domNode), e));
597
- this.contextMenuService.showContextMenu({
598
- getAnchor: () => event,
599
- menuId: MenuId.CommentThreadCommentContext,
600
- menuActionOptions: { shouldForwardArgs: true },
601
- contextKeyService: this._contextKeyService,
602
- actionRunner: ( new CommentsActionRunner()),
603
- getActionsContext: () => {
604
- return this.commentNodeContext;
605
- },
606
- });
607
- }
608
- focus() {
609
- this.domNode.focus();
610
- if (!this._clearTimeout) {
611
- this.domNode.classList.add('focus');
612
- this._clearTimeout = setTimeout(() => {
613
- this.domNode.classList.remove('focus');
614
- }, 3000);
615
- }
616
- }
617
- };
618
- CommentNode = ( __decorate([
619
- ( __param(8, IInstantiationService)),
620
- ( __param(9, ICommentService)),
621
- ( __param(10, IModelService)),
622
- ( __param(11, ILanguageService)),
623
- ( __param(12, INotificationService)),
624
- ( __param(13, IContextMenuService)),
625
- ( __param(14, IContextKeyService)),
626
- ( __param(15, IConfigurationService)),
627
- ( __param(16, IAccessibilityService))
628
- ], CommentNode));
629
- function fillInActions(groups, target, useAlternativeActions, isPrimaryGroup = group => group === 'navigation') {
630
- for (const tuple of groups) {
631
- let [group, actions] = tuple;
632
- if (useAlternativeActions) {
633
- actions = ( actions.map(a => (a instanceof MenuItemAction) && !!a.alt ? a.alt : a));
634
- }
635
- if (isPrimaryGroup(group)) {
636
- const to = Array.isArray(target) ? target : target.primary;
637
- to.unshift(...actions);
638
- }
639
- else {
640
- const to = Array.isArray(target) ? target : target.secondary;
641
- if (to.length > 0) {
642
- to.push(( new Separator()));
643
- }
644
- to.push(...actions);
645
- }
646
- }
647
- }
648
-
649
- export { CommentNode };