@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,302 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
-
import { MOUSE_CURSOR_TEXT_CSS_CLASS_NAME } from 'monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js';
|
|
4
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
-
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
6
|
-
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
7
|
-
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
8
|
-
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
9
|
-
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
10
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
11
|
-
import { resolveColorValue, editorForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
12
|
-
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
13
|
-
import { CommentFormActions } from './commentFormActions.js';
|
|
14
|
-
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
|
|
15
|
-
import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
|
|
16
|
-
import { MIN_EDITOR_HEIGHT, SimpleCommentEditor, calculateEditorHeight } from 'vscode/vscode/vs/workbench/contrib/comments/browser/simpleCommentEditor';
|
|
17
|
-
|
|
18
|
-
const COMMENT_SCHEME = 'comment';
|
|
19
|
-
let INMEM_MODEL_ID = 0;
|
|
20
|
-
const COMMENTEDITOR_DECORATION_KEY = 'commenteditordecoration';
|
|
21
|
-
let CommentReply = class CommentReply extends Disposable {
|
|
22
|
-
constructor(owner, container, _parentEditor, _commentThread, _scopedInstatiationService, _contextKeyService, _commentMenus, _commentOptions, _pendingComment, _parentThread, _actionRunDelegate, commentService, languageService, modelService, themeService, configurationService) {
|
|
23
|
-
super();
|
|
24
|
-
this.owner = owner;
|
|
25
|
-
this._parentEditor = _parentEditor;
|
|
26
|
-
this._commentThread = _commentThread;
|
|
27
|
-
this._scopedInstatiationService = _scopedInstatiationService;
|
|
28
|
-
this._contextKeyService = _contextKeyService;
|
|
29
|
-
this._commentMenus = _commentMenus;
|
|
30
|
-
this._commentOptions = _commentOptions;
|
|
31
|
-
this._pendingComment = _pendingComment;
|
|
32
|
-
this._parentThread = _parentThread;
|
|
33
|
-
this._actionRunDelegate = _actionRunDelegate;
|
|
34
|
-
this.commentService = commentService;
|
|
35
|
-
this.languageService = languageService;
|
|
36
|
-
this.modelService = modelService;
|
|
37
|
-
this.themeService = themeService;
|
|
38
|
-
this._commentThreadDisposables = [];
|
|
39
|
-
this._editorHeight = MIN_EDITOR_HEIGHT;
|
|
40
|
-
this.form = dom.append(container, dom.$('.comment-form'));
|
|
41
|
-
this.commentEditor = this._register(this._scopedInstatiationService.createInstance(SimpleCommentEditor, this.form, SimpleCommentEditor.getEditorOptions(configurationService), _contextKeyService, this._parentThread));
|
|
42
|
-
this.commentEditorIsEmpty = CommentContextKeys.commentIsEmpty.bindTo(this._contextKeyService);
|
|
43
|
-
this.commentEditorIsEmpty.set(!this._pendingComment);
|
|
44
|
-
const hasExistingComments = this._commentThread.comments && this._commentThread.comments.length > 0;
|
|
45
|
-
const modeId = generateUuid() + '-' + (hasExistingComments ? this._commentThread.threadId : ++INMEM_MODEL_ID);
|
|
46
|
-
const params = JSON.stringify({
|
|
47
|
-
extensionId: this._commentThread.extensionId,
|
|
48
|
-
commentThreadId: this._commentThread.threadId
|
|
49
|
-
});
|
|
50
|
-
let resource = ( URI.parse(
|
|
51
|
-
`${COMMENT_SCHEME}://${this._commentThread.extensionId}/commentinput-${modeId}.md?${params}`
|
|
52
|
-
));
|
|
53
|
-
const commentController = this.commentService.getCommentController(owner);
|
|
54
|
-
if (commentController) {
|
|
55
|
-
resource = resource.with({ authority: commentController.id });
|
|
56
|
-
}
|
|
57
|
-
const model = this.modelService.createModel(this._pendingComment || '', this.languageService.createByFilepathOrFirstLine(resource), resource, false);
|
|
58
|
-
this._register(model);
|
|
59
|
-
this.commentEditor.setModel(model);
|
|
60
|
-
this.calculateEditorHeight();
|
|
61
|
-
this._register((model.onDidChangeContent(() => {
|
|
62
|
-
this.setCommentEditorDecorations();
|
|
63
|
-
this.commentEditorIsEmpty?.set(!this.commentEditor.getValue());
|
|
64
|
-
if (this.calculateEditorHeight()) {
|
|
65
|
-
this.commentEditor.layout({ height: this._editorHeight, width: this.commentEditor.getLayoutInfo().width });
|
|
66
|
-
this.commentEditor.render(true);
|
|
67
|
-
}
|
|
68
|
-
})));
|
|
69
|
-
this.createTextModelListener(this.commentEditor, this.form);
|
|
70
|
-
this.setCommentEditorDecorations();
|
|
71
|
-
if (hasExistingComments) {
|
|
72
|
-
this.createReplyButton(this.commentEditor, this.form);
|
|
73
|
-
}
|
|
74
|
-
else if ((this._commentThread.comments && this._commentThread.comments.length === 0) || this._pendingComment) {
|
|
75
|
-
this.expandReplyArea();
|
|
76
|
-
}
|
|
77
|
-
this._error = dom.append(this.form, dom.$('.validation-error.hidden'));
|
|
78
|
-
const formActions = dom.append(this.form, dom.$('.form-actions'));
|
|
79
|
-
this._formActions = dom.append(formActions, dom.$('.other-actions'));
|
|
80
|
-
this.createCommentWidgetFormActions(this._formActions, model);
|
|
81
|
-
this._editorActions = dom.append(formActions, dom.$('.editor-actions'));
|
|
82
|
-
this.createCommentWidgetEditorActions(this._editorActions, model);
|
|
83
|
-
}
|
|
84
|
-
calculateEditorHeight() {
|
|
85
|
-
const newEditorHeight = calculateEditorHeight(this._parentEditor, this.commentEditor, this._editorHeight);
|
|
86
|
-
if (newEditorHeight !== this._editorHeight) {
|
|
87
|
-
this._editorHeight = newEditorHeight;
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
updateCommentThread(commentThread) {
|
|
93
|
-
const isReplying = this.commentEditor.hasTextFocus();
|
|
94
|
-
if (!this._reviewThreadReplyButton) {
|
|
95
|
-
this.createReplyButton(this.commentEditor, this.form);
|
|
96
|
-
}
|
|
97
|
-
if (this._commentThread.comments && this._commentThread.comments.length === 0) {
|
|
98
|
-
this.expandReplyArea();
|
|
99
|
-
}
|
|
100
|
-
if (isReplying) {
|
|
101
|
-
this.commentEditor.focus();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
getPendingComment() {
|
|
105
|
-
const model = this.commentEditor.getModel();
|
|
106
|
-
if (model && model.getValueLength() > 0) {
|
|
107
|
-
return model.getValue();
|
|
108
|
-
}
|
|
109
|
-
return undefined;
|
|
110
|
-
}
|
|
111
|
-
setPendingComment(comment) {
|
|
112
|
-
this._pendingComment = comment;
|
|
113
|
-
this.expandReplyArea();
|
|
114
|
-
this.commentEditor.setValue(comment);
|
|
115
|
-
}
|
|
116
|
-
layout(widthInPixel) {
|
|
117
|
-
this.commentEditor.layout({ height: this._editorHeight, width: widthInPixel - 54 });
|
|
118
|
-
}
|
|
119
|
-
focusIfNeeded() {
|
|
120
|
-
if (!this._commentThread.comments || !this._commentThread.comments.length) {
|
|
121
|
-
this.commentEditor.focus();
|
|
122
|
-
}
|
|
123
|
-
else if (this.commentEditor.getModel().getValueLength() > 0) {
|
|
124
|
-
this.expandReplyArea();
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
focusCommentEditor() {
|
|
128
|
-
this.commentEditor.focus();
|
|
129
|
-
}
|
|
130
|
-
expandReplyAreaAndFocusCommentEditor() {
|
|
131
|
-
this.expandReplyArea();
|
|
132
|
-
this.commentEditor.focus();
|
|
133
|
-
}
|
|
134
|
-
isCommentEditorFocused() {
|
|
135
|
-
return this.commentEditor.hasWidgetFocus();
|
|
136
|
-
}
|
|
137
|
-
getCommentModel() {
|
|
138
|
-
return this.commentEditor.getModel();
|
|
139
|
-
}
|
|
140
|
-
updateCanReply() {
|
|
141
|
-
if (!this._commentThread.canReply) {
|
|
142
|
-
this.form.style.display = 'none';
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
this.form.style.display = 'block';
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
async submitComment() {
|
|
149
|
-
await this._commentFormActions?.triggerDefaultAction();
|
|
150
|
-
this._pendingComment = undefined;
|
|
151
|
-
}
|
|
152
|
-
setCommentEditorDecorations() {
|
|
153
|
-
const model = this.commentEditor.getModel();
|
|
154
|
-
if (model) {
|
|
155
|
-
const valueLength = model.getValueLength();
|
|
156
|
-
const hasExistingComments = this._commentThread.comments && this._commentThread.comments.length > 0;
|
|
157
|
-
const placeholder = valueLength > 0
|
|
158
|
-
? ''
|
|
159
|
-
: hasExistingComments
|
|
160
|
-
? (this._commentOptions?.placeHolder || ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/commentReply', 'reply', "Reply...")))
|
|
161
|
-
: (this._commentOptions?.placeHolder || ( nls.localizeWithPath(
|
|
162
|
-
'vs/workbench/contrib/comments/browser/commentReply',
|
|
163
|
-
'newComment',
|
|
164
|
-
"Type a new comment"
|
|
165
|
-
)));
|
|
166
|
-
const decorations = [{
|
|
167
|
-
range: {
|
|
168
|
-
startLineNumber: 0,
|
|
169
|
-
endLineNumber: 0,
|
|
170
|
-
startColumn: 0,
|
|
171
|
-
endColumn: 1
|
|
172
|
-
},
|
|
173
|
-
renderOptions: {
|
|
174
|
-
after: {
|
|
175
|
-
contentText: placeholder,
|
|
176
|
-
color: `${resolveColorValue(editorForeground, this.themeService.getColorTheme())?.transparent(0.4)}`
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}];
|
|
180
|
-
this.commentEditor.setDecorationsByType('review-zone-widget', COMMENTEDITOR_DECORATION_KEY, decorations);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
createTextModelListener(commentEditor, commentForm) {
|
|
184
|
-
this._commentThreadDisposables.push(commentEditor.onDidFocusEditorWidget(() => {
|
|
185
|
-
this._commentThread.input = {
|
|
186
|
-
uri: commentEditor.getModel().uri,
|
|
187
|
-
value: commentEditor.getValue()
|
|
188
|
-
};
|
|
189
|
-
this.commentService.setActiveCommentThread(this._commentThread);
|
|
190
|
-
}));
|
|
191
|
-
this._commentThreadDisposables.push(commentEditor.getModel().onDidChangeContent(() => {
|
|
192
|
-
const modelContent = commentEditor.getValue();
|
|
193
|
-
if (this._commentThread.input && this._commentThread.input.uri === commentEditor.getModel().uri && this._commentThread.input.value !== modelContent) {
|
|
194
|
-
const newInput = this._commentThread.input;
|
|
195
|
-
newInput.value = modelContent;
|
|
196
|
-
this._commentThread.input = newInput;
|
|
197
|
-
}
|
|
198
|
-
this.commentService.setActiveCommentThread(this._commentThread);
|
|
199
|
-
}));
|
|
200
|
-
this._commentThreadDisposables.push(this._commentThread.onDidChangeInput(input => {
|
|
201
|
-
const thread = this._commentThread;
|
|
202
|
-
const model = commentEditor.getModel();
|
|
203
|
-
if (thread.input && model && (thread.input.uri !== model.uri)) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
if (!input) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (commentEditor.getValue() !== input.value) {
|
|
210
|
-
commentEditor.setValue(input.value);
|
|
211
|
-
if (input.value === '') {
|
|
212
|
-
this._pendingComment = '';
|
|
213
|
-
commentForm.classList.remove('expand');
|
|
214
|
-
commentEditor.getDomNode().style.outline = '';
|
|
215
|
-
this._error.textContent = '';
|
|
216
|
-
this._error.classList.add('hidden');
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
|
-
createCommentWidgetFormActions(container, model) {
|
|
222
|
-
const menu = this._commentMenus.getCommentThreadActions(this._contextKeyService);
|
|
223
|
-
this._register(menu);
|
|
224
|
-
this._register(menu.onDidChange(() => {
|
|
225
|
-
this._commentFormActions.setActions(menu);
|
|
226
|
-
}));
|
|
227
|
-
this._commentFormActions = ( new CommentFormActions(container, async (action) => {
|
|
228
|
-
await this._actionRunDelegate?.();
|
|
229
|
-
await action.run({
|
|
230
|
-
thread: this._commentThread,
|
|
231
|
-
text: this.commentEditor.getValue(),
|
|
232
|
-
$mid: 9
|
|
233
|
-
});
|
|
234
|
-
this.hideReplyArea();
|
|
235
|
-
}));
|
|
236
|
-
this._register(this._commentFormActions);
|
|
237
|
-
this._commentFormActions.setActions(menu);
|
|
238
|
-
}
|
|
239
|
-
createCommentWidgetEditorActions(container, model) {
|
|
240
|
-
const editorMenu = this._commentMenus.getCommentEditorActions(this._contextKeyService);
|
|
241
|
-
this._register(editorMenu);
|
|
242
|
-
this._register(editorMenu.onDidChange(() => {
|
|
243
|
-
this._commentEditorActions.setActions(editorMenu);
|
|
244
|
-
}));
|
|
245
|
-
this._commentEditorActions = ( new CommentFormActions(container, async (action) => {
|
|
246
|
-
this._actionRunDelegate?.();
|
|
247
|
-
action.run({
|
|
248
|
-
thread: this._commentThread,
|
|
249
|
-
text: this.commentEditor.getValue(),
|
|
250
|
-
$mid: 9
|
|
251
|
-
});
|
|
252
|
-
this.focusCommentEditor();
|
|
253
|
-
}));
|
|
254
|
-
this._register(this._commentEditorActions);
|
|
255
|
-
this._commentEditorActions.setActions(editorMenu, true);
|
|
256
|
-
}
|
|
257
|
-
get isReplyExpanded() {
|
|
258
|
-
return this.form.classList.contains('expand');
|
|
259
|
-
}
|
|
260
|
-
expandReplyArea() {
|
|
261
|
-
if (!this.isReplyExpanded) {
|
|
262
|
-
this.form.classList.add('expand');
|
|
263
|
-
this.commentEditor.focus();
|
|
264
|
-
this.commentEditor.layout();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
clearAndExpandReplyArea() {
|
|
268
|
-
if (!this.isReplyExpanded) {
|
|
269
|
-
this.commentEditor.setValue('');
|
|
270
|
-
this.expandReplyArea();
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
hideReplyArea() {
|
|
274
|
-
this.commentEditor.getDomNode().style.outline = '';
|
|
275
|
-
this.commentEditor.setValue('');
|
|
276
|
-
this._pendingComment = '';
|
|
277
|
-
this.form.classList.remove('expand');
|
|
278
|
-
this._error.textContent = '';
|
|
279
|
-
this._error.classList.add('hidden');
|
|
280
|
-
}
|
|
281
|
-
createReplyButton(commentEditor, commentForm) {
|
|
282
|
-
this._reviewThreadReplyButton = dom.append(commentForm, dom.$(`button.review-thread-reply-button.${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`));
|
|
283
|
-
this._reviewThreadReplyButton.title = this._commentOptions?.prompt || ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/commentReply', 'reply', "Reply..."));
|
|
284
|
-
this._reviewThreadReplyButton.textContent = this._commentOptions?.prompt || ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/commentReply', 'reply', "Reply..."));
|
|
285
|
-
this._register(dom.addDisposableListener(this._reviewThreadReplyButton, 'click', _ => this.clearAndExpandReplyArea()));
|
|
286
|
-
this._register(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.clearAndExpandReplyArea()));
|
|
287
|
-
commentEditor.onDidBlurEditorWidget(() => {
|
|
288
|
-
if (commentEditor.getModel().getValueLength() === 0 && commentForm.classList.contains('expand')) {
|
|
289
|
-
commentForm.classList.remove('expand');
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
CommentReply = ( __decorate([
|
|
295
|
-
( __param(11, ICommentService)),
|
|
296
|
-
( __param(12, ILanguageService)),
|
|
297
|
-
( __param(13, IModelService)),
|
|
298
|
-
( __param(14, IThemeService)),
|
|
299
|
-
( __param(15, IConfigurationService))
|
|
300
|
-
], CommentReply));
|
|
301
|
-
|
|
302
|
-
export { COMMENTEDITOR_DECORATION_KEY, CommentReply };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
2
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
3
|
-
import { CommentFormActions } from './commentFormActions.js';
|
|
4
|
-
|
|
5
|
-
class CommentThreadAdditionalActions extends Disposable {
|
|
6
|
-
constructor(container, _commentThread, _contextKeyService, _commentMenus, _actionRunDelegate) {
|
|
7
|
-
super();
|
|
8
|
-
this._commentThread = _commentThread;
|
|
9
|
-
this._contextKeyService = _contextKeyService;
|
|
10
|
-
this._commentMenus = _commentMenus;
|
|
11
|
-
this._actionRunDelegate = _actionRunDelegate;
|
|
12
|
-
this._container = dom.append(container, dom.$('.comment-additional-actions'));
|
|
13
|
-
dom.append(this._container, dom.$('.section-separator'));
|
|
14
|
-
this._buttonBar = dom.append(this._container, dom.$('.button-bar'));
|
|
15
|
-
this._createAdditionalActions(this._buttonBar);
|
|
16
|
-
}
|
|
17
|
-
_showMenu() {
|
|
18
|
-
this._container?.classList.remove('hidden');
|
|
19
|
-
}
|
|
20
|
-
_hideMenu() {
|
|
21
|
-
this._container?.classList.add('hidden');
|
|
22
|
-
}
|
|
23
|
-
_enableDisableMenu(menu) {
|
|
24
|
-
const groups = menu.getActions({ shouldForwardArgs: true });
|
|
25
|
-
for (const group of groups) {
|
|
26
|
-
const [, actions] = group;
|
|
27
|
-
for (const action of actions) {
|
|
28
|
-
if (action.enabled) {
|
|
29
|
-
this._showMenu();
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
for (const subAction of action.actions ?? []) {
|
|
33
|
-
if (subAction.enabled) {
|
|
34
|
-
this._showMenu();
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
this._hideMenu();
|
|
41
|
-
}
|
|
42
|
-
_createAdditionalActions(container) {
|
|
43
|
-
const menu = this._commentMenus.getCommentThreadAdditionalActions(this._contextKeyService);
|
|
44
|
-
this._register(menu);
|
|
45
|
-
this._register(menu.onDidChange(() => {
|
|
46
|
-
this._commentFormActions.setActions(menu, true);
|
|
47
|
-
this._enableDisableMenu(menu);
|
|
48
|
-
}));
|
|
49
|
-
this._commentFormActions = ( new CommentFormActions(container, async (action) => {
|
|
50
|
-
this._actionRunDelegate?.();
|
|
51
|
-
action.run({
|
|
52
|
-
thread: this._commentThread,
|
|
53
|
-
$mid: 8
|
|
54
|
-
});
|
|
55
|
-
}, 4));
|
|
56
|
-
this._register(this._commentFormActions);
|
|
57
|
-
this._commentFormActions.setActions(menu, true);
|
|
58
|
-
this._enableDisableMenu(menu);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { CommentThreadAdditionalActions };
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
-
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
-
import * as languages from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
6
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
7
|
-
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
|
|
8
|
-
import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
9
|
-
import { CommentNode } from './commentNode.js';
|
|
10
|
-
import { MarkdownRenderer } from 'monaco-editor/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.js';
|
|
11
|
-
import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
12
|
-
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
13
|
-
|
|
14
|
-
let CommentThreadBody = class CommentThreadBody extends Disposable {
|
|
15
|
-
get length() {
|
|
16
|
-
return this._commentThread.comments ? this._commentThread.comments.length : 0;
|
|
17
|
-
}
|
|
18
|
-
get activeComment() {
|
|
19
|
-
return this._commentElements.filter(node => node.isEditing)[0];
|
|
20
|
-
}
|
|
21
|
-
constructor(_parentEditor, owner, parentResourceUri, container, _options, _commentThread, _pendingEdits, _scopedInstatiationService, _parentCommentThreadWidget, commentService, openerService, languageService) {
|
|
22
|
-
super();
|
|
23
|
-
this._parentEditor = _parentEditor;
|
|
24
|
-
this.owner = owner;
|
|
25
|
-
this.parentResourceUri = parentResourceUri;
|
|
26
|
-
this.container = container;
|
|
27
|
-
this._options = _options;
|
|
28
|
-
this._commentThread = _commentThread;
|
|
29
|
-
this._pendingEdits = _pendingEdits;
|
|
30
|
-
this._scopedInstatiationService = _scopedInstatiationService;
|
|
31
|
-
this._parentCommentThreadWidget = _parentCommentThreadWidget;
|
|
32
|
-
this.commentService = commentService;
|
|
33
|
-
this.openerService = openerService;
|
|
34
|
-
this.languageService = languageService;
|
|
35
|
-
this._commentElements = [];
|
|
36
|
-
this._focusedComment = undefined;
|
|
37
|
-
this._onDidResize = ( new Emitter());
|
|
38
|
-
this.onDidResize = this._onDidResize.event;
|
|
39
|
-
this._commentDisposable = ( new Map());
|
|
40
|
-
this._register(dom.addDisposableListener(container, dom.EventType.FOCUS_IN, e => {
|
|
41
|
-
this.commentService.setActiveCommentThread(this._commentThread);
|
|
42
|
-
}));
|
|
43
|
-
this._markdownRenderer = this._register(( new MarkdownRenderer(this._options, this.languageService, this.openerService)));
|
|
44
|
-
}
|
|
45
|
-
focus() {
|
|
46
|
-
this._commentsElement.focus();
|
|
47
|
-
}
|
|
48
|
-
display() {
|
|
49
|
-
this._commentsElement = dom.append(this.container, dom.$('div.comments-container'));
|
|
50
|
-
this._commentsElement.setAttribute('role', 'presentation');
|
|
51
|
-
this._commentsElement.tabIndex = 0;
|
|
52
|
-
this._updateAriaLabel();
|
|
53
|
-
this._register(dom.addDisposableListener(this._commentsElement, dom.EventType.KEY_DOWN, (e) => {
|
|
54
|
-
const event = ( new StandardKeyboardEvent(e));
|
|
55
|
-
if ((event.equals(16 ) || event.equals(18 )) && (!this._focusedComment || !this._commentElements[this._focusedComment].isEditing)) {
|
|
56
|
-
const moveFocusWithinBounds = (change) => {
|
|
57
|
-
if (this._focusedComment === undefined && change >= 0) {
|
|
58
|
-
return 0;
|
|
59
|
-
}
|
|
60
|
-
if (this._focusedComment === undefined && change < 0) {
|
|
61
|
-
return this._commentElements.length - 1;
|
|
62
|
-
}
|
|
63
|
-
const newIndex = this._focusedComment + change;
|
|
64
|
-
return Math.min(Math.max(0, newIndex), this._commentElements.length - 1);
|
|
65
|
-
};
|
|
66
|
-
this._setFocusedComment(event.equals(16 ) ? moveFocusWithinBounds(-1) : moveFocusWithinBounds(1));
|
|
67
|
-
}
|
|
68
|
-
}));
|
|
69
|
-
this._commentElements = [];
|
|
70
|
-
if (this._commentThread.comments) {
|
|
71
|
-
for (const comment of this._commentThread.comments) {
|
|
72
|
-
const newCommentNode = this.createNewCommentNode(comment);
|
|
73
|
-
this._commentElements.push(newCommentNode);
|
|
74
|
-
this._commentsElement.appendChild(newCommentNode.domNode);
|
|
75
|
-
if (comment.mode === languages.CommentMode.Editing) {
|
|
76
|
-
newCommentNode.switchToEditMode();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
this._resizeObserver = ( new MutationObserver(this._refresh.bind(this)));
|
|
81
|
-
this._resizeObserver.observe(this.container, {
|
|
82
|
-
attributes: true,
|
|
83
|
-
childList: true,
|
|
84
|
-
characterData: true,
|
|
85
|
-
subtree: true
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
_refresh() {
|
|
89
|
-
const dimensions = dom.getClientArea(this.container);
|
|
90
|
-
this._onDidResize.fire(dimensions);
|
|
91
|
-
}
|
|
92
|
-
getDimensions() {
|
|
93
|
-
return dom.getClientArea(this.container);
|
|
94
|
-
}
|
|
95
|
-
layout(widthInPixel) {
|
|
96
|
-
this._commentElements.forEach(element => {
|
|
97
|
-
element.layout(widthInPixel);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
getPendingEdits() {
|
|
101
|
-
const pendingEdits = {};
|
|
102
|
-
this._commentElements.forEach(element => {
|
|
103
|
-
if (element.isEditing) {
|
|
104
|
-
const pendingEdit = element.getPendingEdit();
|
|
105
|
-
if (pendingEdit) {
|
|
106
|
-
pendingEdits[element.comment.uniqueIdInThread] = pendingEdit;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
return pendingEdits;
|
|
111
|
-
}
|
|
112
|
-
getCommentCoords(commentUniqueId) {
|
|
113
|
-
const matchedNode = this._commentElements.filter(commentNode => commentNode.comment.uniqueIdInThread === commentUniqueId);
|
|
114
|
-
if (matchedNode && matchedNode.length) {
|
|
115
|
-
const commentThreadCoords = dom.getDomNodePagePosition(this._commentElements[0].domNode);
|
|
116
|
-
const commentCoords = dom.getDomNodePagePosition(matchedNode[0].domNode);
|
|
117
|
-
return {
|
|
118
|
-
thread: commentThreadCoords,
|
|
119
|
-
comment: commentCoords
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
updateCommentThread(commentThread, preserveFocus) {
|
|
125
|
-
const oldCommentsLen = this._commentElements.length;
|
|
126
|
-
const newCommentsLen = commentThread.comments ? commentThread.comments.length : 0;
|
|
127
|
-
const commentElementsToDel = [];
|
|
128
|
-
const commentElementsToDelIndex = [];
|
|
129
|
-
for (let i = 0; i < oldCommentsLen; i++) {
|
|
130
|
-
const comment = this._commentElements[i].comment;
|
|
131
|
-
const newComment = commentThread.comments ? commentThread.comments.filter(c => c.uniqueIdInThread === comment.uniqueIdInThread) : [];
|
|
132
|
-
if (newComment.length) {
|
|
133
|
-
this._commentElements[i].update(newComment[0]);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
commentElementsToDelIndex.push(i);
|
|
137
|
-
commentElementsToDel.push(this._commentElements[i]);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
for (let i = commentElementsToDel.length - 1; i >= 0; i--) {
|
|
141
|
-
const commentToDelete = commentElementsToDel[i];
|
|
142
|
-
this._commentDisposable.get(commentToDelete)?.dispose();
|
|
143
|
-
this._commentDisposable.delete(commentToDelete);
|
|
144
|
-
this._commentElements.splice(commentElementsToDelIndex[i], 1);
|
|
145
|
-
this._commentsElement.removeChild(commentToDelete.domNode);
|
|
146
|
-
}
|
|
147
|
-
let lastCommentElement = null;
|
|
148
|
-
const newCommentNodeList = [];
|
|
149
|
-
const newCommentsInEditMode = [];
|
|
150
|
-
for (let i = newCommentsLen - 1; i >= 0; i--) {
|
|
151
|
-
const currentComment = commentThread.comments[i];
|
|
152
|
-
const oldCommentNode = this._commentElements.filter(commentNode => commentNode.comment.uniqueIdInThread === currentComment.uniqueIdInThread);
|
|
153
|
-
if (oldCommentNode.length) {
|
|
154
|
-
lastCommentElement = oldCommentNode[0].domNode;
|
|
155
|
-
newCommentNodeList.unshift(oldCommentNode[0]);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
const newElement = this.createNewCommentNode(currentComment);
|
|
159
|
-
newCommentNodeList.unshift(newElement);
|
|
160
|
-
if (lastCommentElement) {
|
|
161
|
-
this._commentsElement.insertBefore(newElement.domNode, lastCommentElement);
|
|
162
|
-
lastCommentElement = newElement.domNode;
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
this._commentsElement.appendChild(newElement.domNode);
|
|
166
|
-
lastCommentElement = newElement.domNode;
|
|
167
|
-
}
|
|
168
|
-
if (currentComment.mode === languages.CommentMode.Editing) {
|
|
169
|
-
newElement.switchToEditMode();
|
|
170
|
-
newCommentsInEditMode.push(newElement);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
this._commentThread = commentThread;
|
|
175
|
-
this._commentElements = newCommentNodeList;
|
|
176
|
-
if (newCommentsInEditMode.length) {
|
|
177
|
-
const lastIndex = this._commentElements.indexOf(newCommentsInEditMode[newCommentsInEditMode.length - 1]);
|
|
178
|
-
this._focusedComment = lastIndex;
|
|
179
|
-
}
|
|
180
|
-
this._updateAriaLabel();
|
|
181
|
-
if (!preserveFocus) {
|
|
182
|
-
this._setFocusedComment(this._focusedComment);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
_updateAriaLabel() {
|
|
186
|
-
if (this._commentThread.isDocumentCommentThread()) {
|
|
187
|
-
if (this._commentThread.range) {
|
|
188
|
-
this._commentsElement.ariaLabel = ( nls.localizeWithPath(
|
|
189
|
-
'vs/workbench/contrib/comments/browser/commentThreadBody',
|
|
190
|
-
'commentThreadAria.withRange',
|
|
191
|
-
"Comment thread with {0} comments on lines {1} through {2}. {3}.",
|
|
192
|
-
this._commentThread.comments?.length,
|
|
193
|
-
this._commentThread.range.startLineNumber,
|
|
194
|
-
this._commentThread.range.endLineNumber,
|
|
195
|
-
this._commentThread.label
|
|
196
|
-
));
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
this._commentsElement.ariaLabel = ( nls.localizeWithPath(
|
|
200
|
-
'vs/workbench/contrib/comments/browser/commentThreadBody',
|
|
201
|
-
'commentThreadAria.document',
|
|
202
|
-
"Comment thread with {0} comments on the entire document. {1}.",
|
|
203
|
-
this._commentThread.comments?.length,
|
|
204
|
-
this._commentThread.label
|
|
205
|
-
));
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
this._commentsElement.ariaLabel = ( nls.localizeWithPath(
|
|
210
|
-
'vs/workbench/contrib/comments/browser/commentThreadBody',
|
|
211
|
-
'commentThreadAria',
|
|
212
|
-
"Comment thread with {0} comments. {1}.",
|
|
213
|
-
this._commentThread.comments?.length,
|
|
214
|
-
this._commentThread.label
|
|
215
|
-
));
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
_setFocusedComment(value) {
|
|
219
|
-
if (this._focusedComment !== undefined) {
|
|
220
|
-
this._commentElements[this._focusedComment]?.setFocus(false);
|
|
221
|
-
}
|
|
222
|
-
if (this._commentElements.length === 0 || value === undefined) {
|
|
223
|
-
this._focusedComment = undefined;
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
this._focusedComment = Math.min(value, this._commentElements.length - 1);
|
|
227
|
-
this._commentElements[this._focusedComment].setFocus(true);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
createNewCommentNode(comment) {
|
|
231
|
-
const newCommentNode = this._scopedInstatiationService.createInstance(CommentNode, this._parentEditor, this._commentThread, comment, this._pendingEdits ? this._pendingEdits[comment.uniqueIdInThread] : undefined, this.owner, this.parentResourceUri, this._parentCommentThreadWidget, this._markdownRenderer);
|
|
232
|
-
this._register(newCommentNode);
|
|
233
|
-
this._commentDisposable.set(newCommentNode, newCommentNode.onDidClick(clickedNode => this._setFocusedComment(this._commentElements.findIndex(commentNode => commentNode.comment.uniqueIdInThread === clickedNode.comment.uniqueIdInThread))));
|
|
234
|
-
return newCommentNode;
|
|
235
|
-
}
|
|
236
|
-
dispose() {
|
|
237
|
-
super.dispose();
|
|
238
|
-
if (this._resizeObserver) {
|
|
239
|
-
this._resizeObserver.disconnect();
|
|
240
|
-
this._resizeObserver = null;
|
|
241
|
-
}
|
|
242
|
-
this._commentDisposable.forEach(v => v.dispose());
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
CommentThreadBody = ( __decorate([
|
|
246
|
-
( __param(9, ICommentService)),
|
|
247
|
-
( __param(10, IOpenerService)),
|
|
248
|
-
( __param(11, ILanguageService))
|
|
249
|
-
], CommentThreadBody));
|
|
250
|
-
|
|
251
|
-
export { CommentThreadBody };
|