@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.
- package/extensions.js +3 -3
- package/package.json +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +1 -1
- package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +8 -8
- package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +2 -2
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +1 -1
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +0 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditorInput.js +0 -141
- package/vscode/src/vs/workbench/contrib/chat/browser/chatFollowups.js +0 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +0 -342
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +0 -1197
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +0 -117
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOptions.js +0 -83
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +0 -543
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +0 -292
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +0 -169
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -255
- package/vscode/src/vs/workbench/contrib/chat/common/chatRequestParser.js +0 -195
- package/vscode/src/vs/workbench/contrib/chat/common/chatViewModel.js +0 -260
- package/vscode/src/vs/workbench/contrib/chat/common/chatWidgetHistoryService.js +0 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +0 -26
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -63
- package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -51
- package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -649
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -302
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -62
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -251
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -109
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -335
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -101
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -57
- package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -3
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -144
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -482
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -92
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -56
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -110
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -260
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -616
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -309
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -38
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -167
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -80
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -70
- package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -108
- package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +0 -506
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +0 -132
- package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -79
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
-
import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
|
|
3
|
-
import { Action, ActionRunner } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
4
|
-
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
5
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
-
import * as strings from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
7
|
-
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
8
|
-
import { createActionViewItem } from 'monaco-editor/esm/vs/platform/actions/browser/menuEntryActionViewItem.js';
|
|
9
|
-
import { registerIcon } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
10
|
-
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
11
|
-
import { StandardMouseEvent } from 'monaco-editor/esm/vs/base/browser/mouseEvent.js';
|
|
12
|
-
|
|
13
|
-
const collapseIcon = registerIcon('review-comment-collapse', Codicon.chevronUp, ( nls.localizeWithPath(
|
|
14
|
-
'vs/workbench/contrib/comments/browser/commentThreadHeader',
|
|
15
|
-
'collapseIcon',
|
|
16
|
-
'Icon to collapse a review comment.'
|
|
17
|
-
)));
|
|
18
|
-
const COLLAPSE_ACTION_CLASS = 'expand-review-action ' + ThemeIcon.asClassName(collapseIcon);
|
|
19
|
-
class CommentThreadHeader extends Disposable {
|
|
20
|
-
constructor(container, _delegate, _commentMenus, _commentThread, _contextKeyService, instantiationService, _contextMenuService) {
|
|
21
|
-
super();
|
|
22
|
-
this._delegate = _delegate;
|
|
23
|
-
this._commentMenus = _commentMenus;
|
|
24
|
-
this._commentThread = _commentThread;
|
|
25
|
-
this._contextKeyService = _contextKeyService;
|
|
26
|
-
this.instantiationService = instantiationService;
|
|
27
|
-
this._contextMenuService = _contextMenuService;
|
|
28
|
-
this._headElement = dom.$('.head');
|
|
29
|
-
container.appendChild(this._headElement);
|
|
30
|
-
this._fillHead();
|
|
31
|
-
}
|
|
32
|
-
_fillHead() {
|
|
33
|
-
const titleElement = dom.append(this._headElement, dom.$('.review-title'));
|
|
34
|
-
this._headingLabel = dom.append(titleElement, dom.$('span.filename'));
|
|
35
|
-
this.createThreadLabel();
|
|
36
|
-
const actionsContainer = dom.append(this._headElement, dom.$('.review-actions'));
|
|
37
|
-
this._actionbarWidget = ( new ActionBar(actionsContainer, {
|
|
38
|
-
actionViewItemProvider: createActionViewItem.bind(undefined, this.instantiationService)
|
|
39
|
-
}));
|
|
40
|
-
this._register(this._actionbarWidget);
|
|
41
|
-
this._collapseAction = ( new Action('review.expand', ( nls.localizeWithPath(
|
|
42
|
-
'vs/workbench/contrib/comments/browser/commentThreadHeader',
|
|
43
|
-
'label.collapse',
|
|
44
|
-
"Collapse"
|
|
45
|
-
)), COLLAPSE_ACTION_CLASS, true, () => this._delegate.collapse()));
|
|
46
|
-
const menu = this._commentMenus.getCommentThreadTitleActions(this._contextKeyService);
|
|
47
|
-
this.setActionBarActions(menu);
|
|
48
|
-
this._register(menu);
|
|
49
|
-
this._register(menu.onDidChange(e => {
|
|
50
|
-
this.setActionBarActions(menu);
|
|
51
|
-
}));
|
|
52
|
-
this._register(dom.addDisposableListener(this._headElement, dom.EventType.CONTEXT_MENU, e => {
|
|
53
|
-
return this.onContextMenu(e);
|
|
54
|
-
}));
|
|
55
|
-
this._actionbarWidget.context = this._commentThread;
|
|
56
|
-
}
|
|
57
|
-
setActionBarActions(menu) {
|
|
58
|
-
const groups = menu.getActions({ shouldForwardArgs: true }).reduce((r, [, actions]) => [...r, ...actions], []);
|
|
59
|
-
this._actionbarWidget.clear();
|
|
60
|
-
this._actionbarWidget.push([...groups, this._collapseAction], { label: false, icon: true });
|
|
61
|
-
}
|
|
62
|
-
updateCommentThread(commentThread) {
|
|
63
|
-
this._commentThread = commentThread;
|
|
64
|
-
this._actionbarWidget.context = this._commentThread;
|
|
65
|
-
this.createThreadLabel();
|
|
66
|
-
}
|
|
67
|
-
createThreadLabel() {
|
|
68
|
-
let label;
|
|
69
|
-
label = this._commentThread.label;
|
|
70
|
-
if (label === undefined) {
|
|
71
|
-
if (!(this._commentThread.comments && this._commentThread.comments.length)) {
|
|
72
|
-
label = ( nls.localizeWithPath(
|
|
73
|
-
'vs/workbench/contrib/comments/browser/commentThreadHeader',
|
|
74
|
-
'startThread',
|
|
75
|
-
"Start discussion"
|
|
76
|
-
));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (label) {
|
|
80
|
-
this._headingLabel.textContent = strings.escape(label);
|
|
81
|
-
this._headingLabel.setAttribute('aria-label', label);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
updateHeight(headHeight) {
|
|
85
|
-
this._headElement.style.height = `${headHeight}px`;
|
|
86
|
-
this._headElement.style.lineHeight = this._headElement.style.height;
|
|
87
|
-
}
|
|
88
|
-
onContextMenu(e) {
|
|
89
|
-
const actions = ( this._commentMenus.getCommentThreadTitleContextActions(this._contextKeyService).getActions({ shouldForwardArgs: true }).map((value) => value[1])).flat();
|
|
90
|
-
if (!actions.length) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const event = ( new StandardMouseEvent(dom.getWindow(this._headElement), e));
|
|
94
|
-
this._contextMenuService.showContextMenu({
|
|
95
|
-
getAnchor: () => event,
|
|
96
|
-
getActions: () => actions,
|
|
97
|
-
actionRunner: ( new ActionRunner()),
|
|
98
|
-
getActionsContext: () => {
|
|
99
|
-
return {
|
|
100
|
-
commentControlHandle: this._commentThread.controllerHandle,
|
|
101
|
-
commentThreadHandle: this._commentThread.commentThreadHandle,
|
|
102
|
-
$mid: 7
|
|
103
|
-
};
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export { CommentThreadHeader };
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import './media/review.css.js';
|
|
3
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
4
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
5
|
-
import { Disposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
-
import * as languages from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
7
|
-
import { CommentReply } from './commentReply.js';
|
|
8
|
-
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
|
|
9
|
-
import { CommentThreadBody } from './commentThreadBody.js';
|
|
10
|
-
import { CommentThreadHeader } from './commentThreadHeader.js';
|
|
11
|
-
import { CommentThreadAdditionalActions } from './commentThreadAdditionalActions.js';
|
|
12
|
-
import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
|
|
13
|
-
import { textLinkForeground, textLinkActiveForeground, focusBorder, textBlockQuoteBackground, textBlockQuoteBorder, contrastBorder, inputValidationErrorBorder, inputValidationErrorBackground, inputValidationErrorForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
14
|
-
import { PANEL_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
|
|
15
|
-
import { commentThreadStateColorVar, commentThreadStateBackgroundColorVar } from './commentColors.js';
|
|
16
|
-
import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
|
|
17
|
-
import { registerNavigableContainer } from 'vscode/vscode/vs/workbench/browser/actions/widgetNavigationCommands';
|
|
18
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
19
|
-
import { COMMENTS_SECTION } from '../common/commentsConfiguration.js';
|
|
20
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
21
|
-
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
22
|
-
|
|
23
|
-
let CommentThreadWidget = class CommentThreadWidget extends Disposable {
|
|
24
|
-
get commentThread() {
|
|
25
|
-
return this._commentThread;
|
|
26
|
-
}
|
|
27
|
-
constructor(container, _parentEditor, _owner, _parentResourceUri, _contextKeyService, _scopedInstantiationService, _commentThread, _pendingComment, _pendingEdits, _markdownOptions, _commentOptions, _containerDelegate, commentService, contextMenuService, configurationService, _keybindingService) {
|
|
28
|
-
super();
|
|
29
|
-
this.container = container;
|
|
30
|
-
this._parentEditor = _parentEditor;
|
|
31
|
-
this._owner = _owner;
|
|
32
|
-
this._parentResourceUri = _parentResourceUri;
|
|
33
|
-
this._contextKeyService = _contextKeyService;
|
|
34
|
-
this._scopedInstantiationService = _scopedInstantiationService;
|
|
35
|
-
this._commentThread = _commentThread;
|
|
36
|
-
this._pendingComment = _pendingComment;
|
|
37
|
-
this._pendingEdits = _pendingEdits;
|
|
38
|
-
this._markdownOptions = _markdownOptions;
|
|
39
|
-
this._commentOptions = _commentOptions;
|
|
40
|
-
this._containerDelegate = _containerDelegate;
|
|
41
|
-
this.commentService = commentService;
|
|
42
|
-
this.configurationService = configurationService;
|
|
43
|
-
this._keybindingService = _keybindingService;
|
|
44
|
-
this._commentThreadDisposables = [];
|
|
45
|
-
this._onDidResize = ( new Emitter());
|
|
46
|
-
this.onDidResize = this._onDidResize.event;
|
|
47
|
-
this._threadIsEmpty = CommentContextKeys.commentThreadIsEmpty.bindTo(this._contextKeyService);
|
|
48
|
-
this._threadIsEmpty.set(!_commentThread.comments || !_commentThread.comments.length);
|
|
49
|
-
this._focusedContextKey = CommentContextKeys.commentFocused.bindTo(this._contextKeyService);
|
|
50
|
-
this._commentMenus = this.commentService.getCommentMenus(this._owner);
|
|
51
|
-
this._header = ( new CommentThreadHeader(container, {
|
|
52
|
-
collapse: this.collapse.bind(this)
|
|
53
|
-
}, this._commentMenus, this._commentThread, this._contextKeyService, this._scopedInstantiationService, contextMenuService));
|
|
54
|
-
this._header.updateCommentThread(this._commentThread);
|
|
55
|
-
const bodyElement = dom.$('.body');
|
|
56
|
-
container.appendChild(bodyElement);
|
|
57
|
-
const tracker = this._register(dom.trackFocus(bodyElement));
|
|
58
|
-
this._register(registerNavigableContainer({
|
|
59
|
-
focusNotifiers: [tracker],
|
|
60
|
-
focusNextWidget: () => {
|
|
61
|
-
if (!this._commentReply?.isCommentEditorFocused()) {
|
|
62
|
-
this._commentReply?.expandReplyAreaAndFocusCommentEditor();
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
focusPreviousWidget: () => {
|
|
66
|
-
if (this._commentReply?.isCommentEditorFocused() && this._commentThread.comments?.length) {
|
|
67
|
-
this._body.focus();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}));
|
|
71
|
-
this._register(tracker.onDidFocus(() => this._focusedContextKey.set(true)));
|
|
72
|
-
this._register(tracker.onDidBlur(() => this._focusedContextKey.reset()));
|
|
73
|
-
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
74
|
-
if (e.affectsConfiguration("accessibility.verbosity.comments" )) {
|
|
75
|
-
this._setAriaLabel();
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
this._body = this._scopedInstantiationService.createInstance(CommentThreadBody, this._parentEditor, this._owner, this._parentResourceUri, bodyElement, this._markdownOptions, this._commentThread, this._pendingEdits, this._scopedInstantiationService, this);
|
|
79
|
-
this._register(this._body);
|
|
80
|
-
this._setAriaLabel();
|
|
81
|
-
this._styleElement = dom.createStyleSheet(this.container);
|
|
82
|
-
this._commentThreadContextValue = CommentContextKeys.commentThreadContext.bindTo(this._contextKeyService);
|
|
83
|
-
this._commentThreadContextValue.set(_commentThread.contextValue);
|
|
84
|
-
const commentControllerKey = CommentContextKeys.commentControllerContext.bindTo(this._contextKeyService);
|
|
85
|
-
const controller = this.commentService.getCommentController(this._owner);
|
|
86
|
-
if (controller?.contextValue) {
|
|
87
|
-
commentControllerKey.set(controller.contextValue);
|
|
88
|
-
}
|
|
89
|
-
this.currentThreadListeners();
|
|
90
|
-
}
|
|
91
|
-
_setAriaLabel() {
|
|
92
|
-
let ariaLabel = ( localizeWithPath(
|
|
93
|
-
'vs/workbench/contrib/comments/browser/commentThreadWidget',
|
|
94
|
-
'commentLabel',
|
|
95
|
-
"Comment"
|
|
96
|
-
));
|
|
97
|
-
let keybinding;
|
|
98
|
-
const verbose = this.configurationService.getValue("accessibility.verbosity.comments" );
|
|
99
|
-
if (verbose) {
|
|
100
|
-
keybinding = this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp" , this._contextKeyService)?.getLabel() ?? undefined;
|
|
101
|
-
}
|
|
102
|
-
if (keybinding) {
|
|
103
|
-
ariaLabel = ( localizeWithPath(
|
|
104
|
-
'vs/workbench/contrib/comments/browser/commentThreadWidget',
|
|
105
|
-
'commentLabelWithKeybinding',
|
|
106
|
-
"{0}, use ({1}) for accessibility help",
|
|
107
|
-
ariaLabel,
|
|
108
|
-
keybinding
|
|
109
|
-
));
|
|
110
|
-
}
|
|
111
|
-
else {
|
|
112
|
-
ariaLabel = ( localizeWithPath(
|
|
113
|
-
'vs/workbench/contrib/comments/browser/commentThreadWidget',
|
|
114
|
-
'commentLabelWithKeybindingNoKeybinding',
|
|
115
|
-
"{0}, run the command Open Accessibility Help which is currently not triggerable via keybinding.",
|
|
116
|
-
ariaLabel
|
|
117
|
-
));
|
|
118
|
-
}
|
|
119
|
-
this._body.container.ariaLabel = ariaLabel;
|
|
120
|
-
}
|
|
121
|
-
updateCurrentThread(hasMouse, hasFocus) {
|
|
122
|
-
if (hasMouse || hasFocus) {
|
|
123
|
-
this.commentService.setCurrentCommentThread(this.commentThread);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
this.commentService.setCurrentCommentThread(undefined);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
currentThreadListeners() {
|
|
130
|
-
let hasMouse = false;
|
|
131
|
-
let hasFocus = false;
|
|
132
|
-
this._register(dom.addDisposableListener(this.container, dom.EventType.MOUSE_ENTER, (e) => {
|
|
133
|
-
if (e.toElement === this.container) {
|
|
134
|
-
hasMouse = true;
|
|
135
|
-
this.updateCurrentThread(hasMouse, hasFocus);
|
|
136
|
-
}
|
|
137
|
-
}, true));
|
|
138
|
-
this._register(dom.addDisposableListener(this.container, dom.EventType.MOUSE_LEAVE, (e) => {
|
|
139
|
-
if (e.fromElement === this.container) {
|
|
140
|
-
hasMouse = false;
|
|
141
|
-
this.updateCurrentThread(hasMouse, hasFocus);
|
|
142
|
-
}
|
|
143
|
-
}, true));
|
|
144
|
-
this._register(dom.addDisposableListener(this.container, dom.EventType.FOCUS_IN, () => {
|
|
145
|
-
hasFocus = true;
|
|
146
|
-
this.updateCurrentThread(hasMouse, hasFocus);
|
|
147
|
-
}, true));
|
|
148
|
-
this._register(dom.addDisposableListener(this.container, dom.EventType.FOCUS_OUT, () => {
|
|
149
|
-
hasFocus = false;
|
|
150
|
-
this.updateCurrentThread(hasMouse, hasFocus);
|
|
151
|
-
}, true));
|
|
152
|
-
}
|
|
153
|
-
updateCommentThread(commentThread) {
|
|
154
|
-
const shouldCollapse = (this._commentThread.collapsibleState === languages.CommentThreadCollapsibleState.Expanded) && (this._commentThreadState === languages.CommentThreadState.Unresolved)
|
|
155
|
-
&& (commentThread.state === languages.CommentThreadState.Resolved);
|
|
156
|
-
this._commentThreadState = commentThread.state;
|
|
157
|
-
this._commentThread = commentThread;
|
|
158
|
-
dispose(this._commentThreadDisposables);
|
|
159
|
-
this._commentThreadDisposables = [];
|
|
160
|
-
this._bindCommentThreadListeners();
|
|
161
|
-
this._body.updateCommentThread(commentThread, this._commentReply?.isCommentEditorFocused() ?? false);
|
|
162
|
-
this._threadIsEmpty.set(!this._body.length);
|
|
163
|
-
this._header.updateCommentThread(commentThread);
|
|
164
|
-
this._commentReply?.updateCommentThread(commentThread);
|
|
165
|
-
if (this._commentThread.contextValue) {
|
|
166
|
-
this._commentThreadContextValue.set(this._commentThread.contextValue);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
this._commentThreadContextValue.reset();
|
|
170
|
-
}
|
|
171
|
-
if (shouldCollapse && this.configurationService.getValue(COMMENTS_SECTION).collapseOnResolve) {
|
|
172
|
-
this.collapse();
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
display(lineHeight) {
|
|
176
|
-
const headHeight = Math.max(23, Math.ceil(lineHeight * 1.2));
|
|
177
|
-
this._header.updateHeight(headHeight);
|
|
178
|
-
this._body.display();
|
|
179
|
-
if (this._commentThread.canReply) {
|
|
180
|
-
this._createCommentForm();
|
|
181
|
-
}
|
|
182
|
-
this._createAdditionalActions();
|
|
183
|
-
this._register(this._body.onDidResize(dimension => {
|
|
184
|
-
this._refresh(dimension);
|
|
185
|
-
}));
|
|
186
|
-
if (this._commentThread.canReply && this._commentReply) {
|
|
187
|
-
this._commentReply.focusIfNeeded();
|
|
188
|
-
}
|
|
189
|
-
this._bindCommentThreadListeners();
|
|
190
|
-
}
|
|
191
|
-
_refresh(dimension) {
|
|
192
|
-
this._body.layout();
|
|
193
|
-
this._onDidResize.fire(dimension);
|
|
194
|
-
}
|
|
195
|
-
dispose() {
|
|
196
|
-
super.dispose();
|
|
197
|
-
this.updateCurrentThread(false, false);
|
|
198
|
-
}
|
|
199
|
-
_bindCommentThreadListeners() {
|
|
200
|
-
this._commentThreadDisposables.push(this._commentThread.onDidChangeCanReply(() => {
|
|
201
|
-
if (this._commentReply) {
|
|
202
|
-
this._commentReply.updateCanReply();
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
if (this._commentThread.canReply) {
|
|
206
|
-
this._createCommentForm();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}));
|
|
210
|
-
this._commentThreadDisposables.push(this._commentThread.onDidChangeComments(async (_) => {
|
|
211
|
-
await this.updateCommentThread(this._commentThread);
|
|
212
|
-
}));
|
|
213
|
-
this._commentThreadDisposables.push(this._commentThread.onDidChangeLabel(_ => {
|
|
214
|
-
this._header.createThreadLabel();
|
|
215
|
-
}));
|
|
216
|
-
}
|
|
217
|
-
_createCommentForm() {
|
|
218
|
-
this._commentReply = this._scopedInstantiationService.createInstance(CommentReply, this._owner, this._body.container, this._parentEditor, this._commentThread, this._scopedInstantiationService, this._contextKeyService, this._commentMenus, this._commentOptions, this._pendingComment, this, this._containerDelegate.actionRunner);
|
|
219
|
-
this._register(this._commentReply);
|
|
220
|
-
}
|
|
221
|
-
_createAdditionalActions() {
|
|
222
|
-
this._additionalActions = this._scopedInstantiationService.createInstance(CommentThreadAdditionalActions, this._body.container, this._commentThread, this._contextKeyService, this._commentMenus, this._containerDelegate.actionRunner);
|
|
223
|
-
this._register(this._additionalActions);
|
|
224
|
-
}
|
|
225
|
-
getCommentCoords(commentUniqueId) {
|
|
226
|
-
return this._body.getCommentCoords(commentUniqueId);
|
|
227
|
-
}
|
|
228
|
-
getPendingEdits() {
|
|
229
|
-
return this._body.getPendingEdits();
|
|
230
|
-
}
|
|
231
|
-
getPendingComment() {
|
|
232
|
-
if (this._commentReply) {
|
|
233
|
-
return this._commentReply.getPendingComment();
|
|
234
|
-
}
|
|
235
|
-
return undefined;
|
|
236
|
-
}
|
|
237
|
-
setPendingComment(comment) {
|
|
238
|
-
this._pendingComment = comment;
|
|
239
|
-
this._commentReply?.setPendingComment(comment);
|
|
240
|
-
}
|
|
241
|
-
getDimensions() {
|
|
242
|
-
return this._body.getDimensions();
|
|
243
|
-
}
|
|
244
|
-
layout(widthInPixel) {
|
|
245
|
-
this._body.layout(widthInPixel);
|
|
246
|
-
if (widthInPixel !== undefined) {
|
|
247
|
-
this._commentReply?.layout(widthInPixel);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
focusCommentEditor() {
|
|
251
|
-
this._commentReply?.focusCommentEditor();
|
|
252
|
-
}
|
|
253
|
-
focus() {
|
|
254
|
-
this._body.focus();
|
|
255
|
-
}
|
|
256
|
-
async submitComment() {
|
|
257
|
-
const activeComment = this._body.activeComment;
|
|
258
|
-
if (activeComment) {
|
|
259
|
-
return activeComment.submitComment();
|
|
260
|
-
}
|
|
261
|
-
else if ((this._commentReply?.getPendingComment()?.length ?? 0) > 0) {
|
|
262
|
-
return this._commentReply?.submitComment();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
collapse() {
|
|
266
|
-
this._containerDelegate.collapse();
|
|
267
|
-
}
|
|
268
|
-
applyTheme(theme, fontInfo) {
|
|
269
|
-
const content = [];
|
|
270
|
-
content.push(`.monaco-editor .review-widget > .body { border-top: 1px solid var(${commentThreadStateColorVar}) }`);
|
|
271
|
-
content.push(`.monaco-editor .review-widget > .head { background-color: var(${commentThreadStateBackgroundColorVar}) }`);
|
|
272
|
-
const linkColor = theme.getColor(textLinkForeground);
|
|
273
|
-
if (linkColor) {
|
|
274
|
-
content.push(`.review-widget .body .comment-body a { color: ${linkColor} }`);
|
|
275
|
-
}
|
|
276
|
-
const linkActiveColor = theme.getColor(textLinkActiveForeground);
|
|
277
|
-
if (linkActiveColor) {
|
|
278
|
-
content.push(`.review-widget .body .comment-body a:hover, a:active { color: ${linkActiveColor} }`);
|
|
279
|
-
}
|
|
280
|
-
const focusColor = theme.getColor(focusBorder);
|
|
281
|
-
if (focusColor) {
|
|
282
|
-
content.push(`.review-widget .body .comment-body a:focus { outline: 1px solid ${focusColor}; }`);
|
|
283
|
-
content.push(`.review-widget .body .monaco-editor.focused { outline: 1px solid ${focusColor}; }`);
|
|
284
|
-
}
|
|
285
|
-
const blockQuoteBackground = theme.getColor(textBlockQuoteBackground);
|
|
286
|
-
if (blockQuoteBackground) {
|
|
287
|
-
content.push(`.review-widget .body .review-comment blockquote { background: ${blockQuoteBackground}; }`);
|
|
288
|
-
}
|
|
289
|
-
const blockQuoteBOrder = theme.getColor(textBlockQuoteBorder);
|
|
290
|
-
if (blockQuoteBOrder) {
|
|
291
|
-
content.push(`.review-widget .body .review-comment blockquote { border-color: ${blockQuoteBOrder}; }`);
|
|
292
|
-
}
|
|
293
|
-
const border = theme.getColor(PANEL_BORDER);
|
|
294
|
-
if (border) {
|
|
295
|
-
content.push(`.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label { border-color: ${border}; }`);
|
|
296
|
-
}
|
|
297
|
-
const hcBorder = theme.getColor(contrastBorder);
|
|
298
|
-
if (hcBorder) {
|
|
299
|
-
content.push(`.review-widget .body .comment-form .review-thread-reply-button { outline-color: ${hcBorder}; }`);
|
|
300
|
-
content.push(`.review-widget .body .monaco-editor { outline: 1px solid ${hcBorder}; }`);
|
|
301
|
-
}
|
|
302
|
-
const errorBorder = theme.getColor(inputValidationErrorBorder);
|
|
303
|
-
if (errorBorder) {
|
|
304
|
-
content.push(`.review-widget .validation-error { border: 1px solid ${errorBorder}; }`);
|
|
305
|
-
}
|
|
306
|
-
const errorBackground = theme.getColor(inputValidationErrorBackground);
|
|
307
|
-
if (errorBackground) {
|
|
308
|
-
content.push(`.review-widget .validation-error { background: ${errorBackground}; }`);
|
|
309
|
-
}
|
|
310
|
-
const errorForeground = theme.getColor(inputValidationErrorForeground);
|
|
311
|
-
if (errorForeground) {
|
|
312
|
-
content.push(`.review-widget .body .comment-form .validation-error { color: ${errorForeground}; }`);
|
|
313
|
-
}
|
|
314
|
-
const fontFamilyVar = '--comment-thread-editor-font-family';
|
|
315
|
-
const fontSizeVar = '--comment-thread-editor-font-size';
|
|
316
|
-
const fontWeightVar = '--comment-thread-editor-font-weight';
|
|
317
|
-
this.container?.style.setProperty(fontFamilyVar, fontInfo.fontFamily);
|
|
318
|
-
this.container?.style.setProperty(fontSizeVar, `${fontInfo.fontSize}px`);
|
|
319
|
-
this.container?.style.setProperty(fontWeightVar, fontInfo.fontWeight);
|
|
320
|
-
content.push(`.review-widget .body code {
|
|
321
|
-
font-family: var(${fontFamilyVar});
|
|
322
|
-
font-weight: var(${fontWeightVar});
|
|
323
|
-
}`);
|
|
324
|
-
this._styleElement.textContent = content.join('\n');
|
|
325
|
-
this._commentReply?.setCommentEditorDecorations();
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
CommentThreadWidget = ( __decorate([
|
|
329
|
-
( __param(12, ICommentService)),
|
|
330
|
-
( __param(13, IContextMenuService)),
|
|
331
|
-
( __param(14, IConfigurationService)),
|
|
332
|
-
( __param(15, IKeybindingService))
|
|
333
|
-
], CommentThreadWidget));
|
|
334
|
-
|
|
335
|
-
export { CommentThreadWidget };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
-
|
|
3
|
-
var css = ".review-widget{position:absolute;width:100%}.monaco-editor .review-widget{background-color:var(--vscode-peekViewResult-background)}.review-widget .hidden{display:none!important}.review-widget .body{overflow:hidden}.review-widget .body .review-comment{display:flex;padding:8px 16px 8px 20px}@keyframes monaco-review-widget-focus{0%{background:var(--vscode-peekViewResult-selectionBackground)}to{background:transparent}}.review-widget .body .review-comment.focus{animation:monaco-review-widget-focus 3s ease 0s}.review-widget .body .review-comment .comment-actions{margin-left:auto}.review-widget .body .review-comment .comment-actions .monaco-toolbar{height:22px}.review-widget .body .review-comment .comment-title .comment-header-info{overflow:hidden;text-overflow:ellipsis}.review-widget .body .review-comment .comment-title{display:flex;width:100%}.review-widget .body .review-comment .comment-title .action-label.codicon{line-height:18px}.review-widget .body .review-comment .comment-title .monaco-dropdown .toolbar-toggle-more{height:18px;line-height:18px;vertical-align:middle;width:16px}.review-widget .body .comment-body blockquote{border-left-style:solid;border-left-width:5px;margin:0 7px 0 5px;padding:0 16px 0 10px}.review-widget .body .review-comment .avatar-container{margin-top:4px!important}.review-widget .body .review-comment .avatar-container img.avatar{border-radius:3px;border-style:none;display:inline-block;height:28px;line-height:1;overflow:hidden;vertical-align:middle;width:28px}.review-widget .body .comment-reactions .monaco-text-button{background-color:transparent;border:1px solid grey;border-radius:3px;margin:0 7px 0 0;width:30px}.review-widget .body .review-comment .review-comment-contents{overflow:hidden;padding-left:20px;user-select:text;-webkit-user-select:text;width:100%}.review-widget .body pre{word-wrap:normal;overflow:auto;white-space:pre}.review-widget .body .review-comment .review-comment-contents .author{line-height:22px}.review-widget .body .review-comment .review-comment-contents .isPending{font-style:italic;line-height:22px;margin:0 5px;padding:0 2px}.review-widget .body .review-comment .review-comment-contents .timestamp{line-height:22px;margin:0 5px;padding:0 2px}.review-widget .body .review-comment .review-comment-contents .comment-body .comment-body-plainstring{white-space:pre-wrap}.review-widget .body .review-comment .review-comment-contents .comment-body{padding-top:4px}.review-widget .body .review-comment .review-comment-contents .comment-body-max-height{max-height:20em}.review-widget .body .review-comment .review-comment-contents .comment-reactions{margin-top:8px;min-height:25px}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item .action-label{display:flex;font-size:12px;padding:1px 4px;text-align:center;white-space:pre}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item .action-label .reaction-icon{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-position:0;background-repeat:no-repeat;background-size:14px;display:inline-block;margin-right:4px;width:14px}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item .action-label .reaction-label{line-height:20px;margin-right:4px}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label.toolbar-toggle-pickReactions{background-position:50%;background-repeat:no-repeat;background-size:16px;border:none;display:none;font-size:16px;height:16px;margin-top:3px;width:26px}.review-widget .body .review-comment .review-comment-contents .comment-reactions:hover .action-item a.action-label.toolbar-toggle-pickReactions{background-size:16px;display:inline-block}.review-widget .body .review-comment .comment-title .action-label{background-position:50%;background-repeat:no-repeat;background-size:16px;display:block;height:16px;line-height:16px}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label{border:1px solid}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label.disabled{opacity:.6}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label.active:hover{background-color:var(--vscode-statusBarItem-hoverBackground)}.review-widget .body .review-comment .review-comment-contents .comment-reactions .action-item a.action-label:active{background-color:var(--vscode-statusBarItem-activeBackground);border:1px solid transparent}.review-widget .body .review-comment .review-comment-contents a{cursor:pointer}.review-widget .body .comment-body p,.review-widget .body .comment-body ul{margin:8px 0}.review-widget .body .comment-body p:first-child,.review-widget .body .comment-body ul:first-child{margin-top:0}.review-widget .body .comment-body p:last-child,.review-widget .body.comment-body ul:last-child{margin-bottom:0}.review-widget .body .comment-body ul{padding-left:20px}.review-widget .body .comment-body li>p{margin-bottom:0}.review-widget .body .comment-body li>ul{margin-top:0}.review-widget .body .comment-body code{border-radius:3px;padding:0 .4em}.review-widget .body .comment-body span{white-space:pre}.review-widget .body .comment-body img{max-width:100%}.review-widget .body .comment-form{margin:8px 20px}.review-widget .validation-error{word-wrap:break-word;box-sizing:border-box;display:inline-block;font-size:12px;line-height:17px;margin-left:-1px;margin-top:-1px;min-height:34px;overflow:hidden;padding:.4em;text-align:left;width:100%}.review-widget .body .comment-additional-actions{margin:10px 20px}.review-widget .body .comment-additional-actions .section-separator{border-top:1px solid var(--vscode-menu-separatorBackground);margin:10px 0 14px}.review-widget .body .comment-additional-actions .button-bar{display:flex;white-space:nowrap}.review-widget .body .comment-additional-actions .monaco-button,.review-widget .body .comment-additional-actions .monaco-button-dropdown,.review-widget .body .comment-additional-actions .monaco-text-button{display:flex;width:auto}.review-widget .body .comment-additional-actions .button-bar>.monaco-button-dropdown,.review-widget .body .comment-additional-actions .button-bar>.monaco-text-button{margin:0 10px 0 0}.review-widget .body .comment-additional-actions .button-bar .monaco-text-button{padding:4px 10px}.review-widget .body .comment-additional-actions .codicon-drop-down-button{align-items:center}.review-widget .body .monaco-editor{color:var(--vscode-editor-foreground)}.review-widget .body .comment-form.expand .review-thread-reply-button{display:none}.review-widget .body .comment-form.expand .form-actions,.review-widget .body .comment-form.expand .monaco-editor{box-sizing:content-box;display:block}.review-widget .body .comment-form .review-thread-reply-button{background-color:var(--vscode-editorCommentsWidget-replyInputBackground);border:0;border-radius:0;box-sizing:border-box;color:var(--vscode-editor-foreground);display:block;font-family:var(--monaco-monospace-font);font-size:inherit;font-weight:600;line-height:20px;outline:1px solid transparent;padding:6px 12px;resize:vertical;text-align:left;white-space:nowrap;width:100%}.review-widget .body .comment-form .review-thread-reply-button:focus{outline-style:solid;outline-width:1px}.review-widget .body .comment-form .monaco-editor,.review-widget .body .comment-form .monaco-editor .monaco-editor-background,.review-widget .body .edit-container .monaco-editor .monaco-editor-background{background-color:var(--vscode-editorCommentsWidget-replyInputBackground)}.review-widget .body .comment-form .monaco-editor,.review-widget .body .edit-container .monaco-editor{border:0;border-radius:3px;box-sizing:content-box;max-height:500px;min-height:90px;padding:6px 0 6px 12px;width:100%}.review-widget .body .comment-form .form-actions,.review-widget .body .comment-form .monaco-editor{display:none}.review-widget .body .comment-form .form-actions,.review-widget .body .edit-container .form-actions{margin:10px 0;overflow:auto}.review-widget .body .edit-container .form-actions{padding-top:10px}.review-widget .body .edit-textarea{margin:5px 12px 10px 0}.review-widget .body .comment-form .monaco-text-button,.review-widget .body .edit-container .monaco-text-button{margin-left:5px;padding:4px 10px;width:auto}.review-widget .body .form-actions .monaco-text-button{float:right}.review-widget .head{box-sizing:border-box;display:flex;height:100%}.review-widget .head .review-title{cursor:default;display:inline-block;font-size:13px;margin-left:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.review-widget .head .review-title .dirname:not(:empty){font-size:.9em;margin-left:.5em}.review-widget .head .review-actions{flex:1;padding-right:2px;text-align:right}.review-widget .head .review-actions>.monaco-action-bar{display:inline-block}.review-widget .head .review-actions>.monaco-action-bar,.review-widget .head .review-actions>.monaco-action-bar>.actions-container{height:100%}.review-widget .action-item{margin-left:4px;min-height:20px;min-width:18px}.review-widget .head .review-actions>.monaco-action-bar .action-label{background-position:50%;background-repeat:no-repeat;line-height:inherit;margin:0}.review-widget .head .review-actions>.monaco-action-bar .action-label.codicon{margin:0}.review-widget>.body{border-top:1px solid;position:relative}.monaco-editor .comment-range-glyph{cursor:pointer;margin-left:10px;width:4px!important;z-index:10}div.preview.inline .monaco-editor .comment-range-glyph{display:none!important}.monaco-editor .comment-diff-added{border-left-style:solid;border-left-width:3px}.monaco-editor .comment-diff-added,.monaco-editor .comment-range-glyph.multiline-add{border-left-color:var(--vscode-editorGutter-commentRangeForeground)}.monaco-editor .comment-diff-added:before,.monaco-editor .comment-range-glyph.line-hover:before,.monaco-editor .comment-thread-unresolved:before,.monaco-editor .comment-thread:before{background:var(--vscode-editorGutter-commentRangeForeground)}.monaco-editor .comment-thread-range{background-color:var(--vscode-editorCommentsWidget-rangeBackground)}.monaco-editor .comment-thread-range-current{background-color:var(--vscode-editorCommentsWidget-rangeActiveBackground)}.monaco-editor .margin-view-overlays .comment-range-glyph.comment-thread,.monaco-editor .margin-view-overlays .comment-range-glyph.comment-thread-unresolved,.monaco-editor .margin-view-overlays .comment-range-glyph.line-hover{margin-left:13px}.monaco-editor .comment-range-glyph.comment-thread-unresolved:before,.monaco-editor .comment-range-glyph.comment-thread:before,.monaco-editor .margin-view-overlays .comment-range-glyph.line-hover:before,.monaco-editor .margin-view-overlays>div:hover>.comment-range-glyph.comment-diff-added:before{align-items:center;color:var(--vscode-editorGutter-commentGlyphForeground);display:flex;flex-direction:row;height:100%;justify-content:center;left:-6px;position:absolute;text-align:center;width:9px;z-index:10}.monaco-editor .comment-range-glyph.comment-thread-unresolved:before{color:var(--vscode-editorGutter-commentUnresolvedGlyphForeground)}.monaco-editor .margin-view-overlays .comment-range-glyph.multiline-add{border-left-style:dotted;border-left-width:3px;height:16px;margin-top:2px}.monaco-editor .margin-view-overlays .comment-range-glyph.line-hover:before,.monaco-editor .margin-view-overlays>div:hover>.comment-range-glyph.comment-diff-added:before{border-radius:3px;content:\"\\ea60\";font-family:codicon;margin-left:-5px;padding-left:1px;width:18px!important}.monaco-editor .comment-range-glyph.comment-thread,.monaco-editor .comment-range-glyph.comment-thread-unresolved{z-index:20}.monaco-editor .comment-range-glyph.comment-thread-unresolved:before,.monaco-editor .comment-range-glyph.comment-thread:before{border-radius:3px;font-family:codicon;font-size:13px;line-height:100%;margin-left:-5px;padding-left:1px;padding-top:1px;width:18px!important;z-index:20}.monaco-editor .comment-range-glyph.comment-thread:before{content:\"\\ea6b\"}.monaco-editor .comment-range-glyph.comment-thread-unresolved:before{content:\"\\ec0a\"}.monaco-editor.inline-comment .margin-view-overlays .codicon-folding-collapsed,.monaco-editor.inline-comment .margin-view-overlays .codicon-folding-expanded{margin-left:11px}.monaco-editor.inline-comment .margin-view-overlays .dirty-diff-glyph{margin-left:25px}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
-
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
4
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
5
|
-
import { ActionViewItem } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionViewItems.js';
|
|
6
|
-
|
|
7
|
-
class ToggleReactionsAction extends Action {
|
|
8
|
-
static { this.ID = 'toolbar.toggle.pickReactions'; }
|
|
9
|
-
constructor(toggleDropdownMenu, title) {
|
|
10
|
-
super(ToggleReactionsAction.ID, title || ( nls.localizeWithPath(
|
|
11
|
-
'vs/workbench/contrib/comments/browser/reactionsAction',
|
|
12
|
-
'pickReactions',
|
|
13
|
-
"Pick Reactions..."
|
|
14
|
-
)), 'toggle-reactions', true);
|
|
15
|
-
this._menuActions = [];
|
|
16
|
-
this.toggleDropdownMenu = toggleDropdownMenu;
|
|
17
|
-
}
|
|
18
|
-
run() {
|
|
19
|
-
this.toggleDropdownMenu();
|
|
20
|
-
return Promise.resolve(true);
|
|
21
|
-
}
|
|
22
|
-
get menuActions() {
|
|
23
|
-
return this._menuActions;
|
|
24
|
-
}
|
|
25
|
-
set menuActions(actions) {
|
|
26
|
-
this._menuActions = actions;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
class ReactionActionViewItem extends ActionViewItem {
|
|
30
|
-
constructor(action) {
|
|
31
|
-
super(null, action, {});
|
|
32
|
-
}
|
|
33
|
-
updateLabel() {
|
|
34
|
-
if (!this.label) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const action = this.action;
|
|
38
|
-
if (action.class) {
|
|
39
|
-
this.label.classList.add(action.class);
|
|
40
|
-
}
|
|
41
|
-
if (!action.icon) {
|
|
42
|
-
const reactionLabel = dom.append(this.label, dom.$('span.reaction-label'));
|
|
43
|
-
reactionLabel.innerText = action.label;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
const reactionIcon = dom.append(this.label, dom.$('.reaction-icon'));
|
|
47
|
-
const uri = URI.revive(action.icon);
|
|
48
|
-
reactionIcon.style.backgroundImage = dom.asCSSUrl(uri);
|
|
49
|
-
reactionIcon.title = action.label;
|
|
50
|
-
}
|
|
51
|
-
if (action.count) {
|
|
52
|
-
const reactionCount = dom.append(this.label, dom.$('span.reaction-count'));
|
|
53
|
-
reactionCount.innerText = `${action.count}`;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
getTooltip() {
|
|
57
|
-
const action = this.action;
|
|
58
|
-
const toggleMessage = action.enabled ? ( nls.localizeWithPath(
|
|
59
|
-
'vs/workbench/contrib/comments/browser/reactionsAction',
|
|
60
|
-
'comment.toggleableReaction',
|
|
61
|
-
"Toggle reaction, "
|
|
62
|
-
)) : '';
|
|
63
|
-
if (action.count === undefined) {
|
|
64
|
-
return ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/reactionsAction', {
|
|
65
|
-
key: 'comment.reactionLabelNone', comment: [
|
|
66
|
-
'This is a tooltip for an emoji button so that the current user can toggle their reaction to a comment.',
|
|
67
|
-
'The first arg is localized message "Toggle reaction" or empty if the user doesn\'t have permission to toggle the reaction, the second is the name of the reaction.'
|
|
68
|
-
]
|
|
69
|
-
}, "{0}{1} reaction", toggleMessage, action.label));
|
|
70
|
-
}
|
|
71
|
-
else if (action.count === 1) {
|
|
72
|
-
return ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/reactionsAction', {
|
|
73
|
-
key: 'comment.reactionLabelOne', comment: [
|
|
74
|
-
'This is a tooltip for an emoji that is a "reaction" to a comment where the count of the reactions is 1.',
|
|
75
|
-
'The emoji is also a button so that the current user can also toggle their own emoji reaction.',
|
|
76
|
-
'The first arg is localized message "Toggle reaction" or empty if the user doesn\'t have permission to toggle the reaction, the second is the name of the reaction.'
|
|
77
|
-
]
|
|
78
|
-
}, "{0}1 reaction with {1}", toggleMessage, action.label));
|
|
79
|
-
}
|
|
80
|
-
else if (action.count > 1) {
|
|
81
|
-
return ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/reactionsAction', {
|
|
82
|
-
key: 'comment.reactionLabelMany', comment: [
|
|
83
|
-
'This is a tooltip for an emoji that is a "reaction" to a comment where the count of the reactions is greater than 1.',
|
|
84
|
-
'The emoji is also a button so that the current user can also toggle their own emoji reaction.',
|
|
85
|
-
'The first arg is localized message "Toggle reaction" or empty if the user doesn\'t have permission to toggle the reaction, the second is number of users who have reacted with that reaction, and the third is the name of the reaction.'
|
|
86
|
-
]
|
|
87
|
-
}, "{0}{1} reactions with {2}", toggleMessage, action.count, action.label));
|
|
88
|
-
}
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
class ReactionAction extends Action {
|
|
93
|
-
static { this.ID = 'toolbar.toggle.reaction'; }
|
|
94
|
-
constructor(id, label = '', cssClass = '', enabled = true, actionCallback, icon, count) {
|
|
95
|
-
super(ReactionAction.ID, label, cssClass, enabled, actionCallback);
|
|
96
|
-
this.icon = icon;
|
|
97
|
-
this.count = count;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { ReactionAction, ReactionActionViewItem, ToggleReactionsAction };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
-
import { fromNow } from 'vscode/vscode/vs/base/common/date';
|
|
3
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
-
import { language } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
5
|
-
import { COMMENTS_SECTION } from '../common/commentsConfiguration.js';
|
|
6
|
-
|
|
7
|
-
class TimestampWidget extends Disposable {
|
|
8
|
-
constructor(configurationService, container, timeStamp) {
|
|
9
|
-
super();
|
|
10
|
-
this.configurationService = configurationService;
|
|
11
|
-
this._date = dom.append(container, dom.$('span.timestamp'));
|
|
12
|
-
this._date.style.display = 'none';
|
|
13
|
-
this._useRelativeTime = this.useRelativeTimeSetting;
|
|
14
|
-
this.setTimestamp(timeStamp);
|
|
15
|
-
}
|
|
16
|
-
get useRelativeTimeSetting() {
|
|
17
|
-
return this.configurationService.getValue(COMMENTS_SECTION).useRelativeTime;
|
|
18
|
-
}
|
|
19
|
-
async setTimestamp(timestamp) {
|
|
20
|
-
if ((timestamp !== this._timestamp) || (this.useRelativeTimeSetting !== this._useRelativeTime)) {
|
|
21
|
-
this.updateDate(timestamp);
|
|
22
|
-
}
|
|
23
|
-
this._timestamp = timestamp;
|
|
24
|
-
this._useRelativeTime = this.useRelativeTimeSetting;
|
|
25
|
-
}
|
|
26
|
-
updateDate(timestamp) {
|
|
27
|
-
if (!timestamp) {
|
|
28
|
-
this._date.textContent = '';
|
|
29
|
-
this._date.style.display = 'none';
|
|
30
|
-
}
|
|
31
|
-
else if ((timestamp !== this._timestamp)
|
|
32
|
-
|| (this.useRelativeTimeSetting !== this._useRelativeTime)) {
|
|
33
|
-
this._date.style.display = '';
|
|
34
|
-
let textContent;
|
|
35
|
-
let tooltip;
|
|
36
|
-
if (this.useRelativeTimeSetting) {
|
|
37
|
-
textContent = this.getRelative(timestamp);
|
|
38
|
-
tooltip = this.getDateString(timestamp);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
textContent = this.getDateString(timestamp);
|
|
42
|
-
}
|
|
43
|
-
this._date.textContent = textContent;
|
|
44
|
-
if (tooltip) {
|
|
45
|
-
this._date.title = tooltip;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
getRelative(date) {
|
|
50
|
-
return fromNow(date, true, true);
|
|
51
|
-
}
|
|
52
|
-
getDateString(date) {
|
|
53
|
-
return date.toLocaleString(language);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export { TimestampWidget };
|