@codingame/monaco-vscode-extensions-service-override 2.1.4 → 2.2.0-next.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 -0
- package/package.json +3 -3
- package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +2 -2
- package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +1 -1
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +1 -1
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/platform/log/browser/log.js +0 -26
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +0 -92
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +0 -109
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +0 -397
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +0 -5
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +0 -1279
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +0 -19
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +0 -125
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +0 -344
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +0 -453
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +0 -178
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +0 -36
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +0 -180
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +0 -5
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { matchesFuzzy2, matchesFuzzy } from 'vscode/vscode/vs/base/common/filters';
|
|
2
|
-
import { ltrim } from 'vscode/vscode/vs/base/common/strings';
|
|
3
|
-
|
|
4
|
-
class FilterOptions {
|
|
5
|
-
static { this._filter = matchesFuzzy2; }
|
|
6
|
-
static { this._messageFilter = matchesFuzzy; }
|
|
7
|
-
constructor(filter, showResolved, showUnresolved) {
|
|
8
|
-
this.filter = filter;
|
|
9
|
-
this.showResolved = true;
|
|
10
|
-
this.showUnresolved = true;
|
|
11
|
-
filter = filter.trim();
|
|
12
|
-
this.showResolved = showResolved;
|
|
13
|
-
this.showUnresolved = showUnresolved;
|
|
14
|
-
const negate = filter.startsWith('!');
|
|
15
|
-
this.textFilter = { text: (negate ? ltrim(filter, '!') : filter).trim(), negate };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { FilterOptions };
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { groupBy } from 'vscode/vscode/vs/base/common/arrays';
|
|
2
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
-
import { ResourceWithCommentThreads } from '../common/commentModel.js';
|
|
5
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
|
-
|
|
7
|
-
class CommentsModel extends Disposable {
|
|
8
|
-
get resourceCommentThreads() { return this._resourceCommentThreads; }
|
|
9
|
-
constructor() {
|
|
10
|
-
super();
|
|
11
|
-
this._resourceCommentThreads = [];
|
|
12
|
-
this.commentThreadsMap = ( new Map());
|
|
13
|
-
}
|
|
14
|
-
updateResourceCommentThreads() {
|
|
15
|
-
const includeLabel = this.commentThreadsMap.size > 1;
|
|
16
|
-
this._resourceCommentThreads = ( [...( this.commentThreadsMap.values())].map(value => {
|
|
17
|
-
return ( value.resourceWithCommentThreads.map(resource => {
|
|
18
|
-
resource.ownerLabel = includeLabel ? value.ownerLabel : undefined;
|
|
19
|
-
return resource;
|
|
20
|
-
})).flat();
|
|
21
|
-
})).flat();
|
|
22
|
-
this._resourceCommentThreads.sort((a, b) => {
|
|
23
|
-
return ( a.resource.toString()) > ( b.resource.toString()) ? 1 : -1;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
setCommentThreads(owner, ownerLabel, commentThreads) {
|
|
27
|
-
this.commentThreadsMap.set(owner, { ownerLabel, resourceWithCommentThreads: this.groupByResource(owner, commentThreads) });
|
|
28
|
-
this.updateResourceCommentThreads();
|
|
29
|
-
}
|
|
30
|
-
deleteCommentsByOwner(owner) {
|
|
31
|
-
if (owner) {
|
|
32
|
-
const existingOwner = this.commentThreadsMap.get(owner);
|
|
33
|
-
this.commentThreadsMap.set(owner, { ownerLabel: existingOwner?.ownerLabel, resourceWithCommentThreads: [] });
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.commentThreadsMap.clear();
|
|
37
|
-
}
|
|
38
|
-
this.updateResourceCommentThreads();
|
|
39
|
-
}
|
|
40
|
-
updateCommentThreads(event) {
|
|
41
|
-
const { owner, ownerLabel, removed, changed, added } = event;
|
|
42
|
-
const threadsForOwner = this.commentThreadsMap.get(owner)?.resourceWithCommentThreads || [];
|
|
43
|
-
removed.forEach(thread => {
|
|
44
|
-
const matchingResourceIndex = threadsForOwner.findIndex((resourceData) => resourceData.id === thread.resource);
|
|
45
|
-
const matchingResourceData = matchingResourceIndex >= 0 ? threadsForOwner[matchingResourceIndex] : undefined;
|
|
46
|
-
const index = matchingResourceData?.commentThreads.findIndex((commentThread) => commentThread.threadId === thread.threadId) ?? 0;
|
|
47
|
-
if (index >= 0) {
|
|
48
|
-
matchingResourceData?.commentThreads.splice(index, 1);
|
|
49
|
-
}
|
|
50
|
-
if (matchingResourceData?.commentThreads.length === 0) {
|
|
51
|
-
threadsForOwner.splice(matchingResourceIndex, 1);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
changed.forEach(thread => {
|
|
55
|
-
const matchingResourceIndex = threadsForOwner.findIndex((resourceData) => resourceData.id === thread.resource);
|
|
56
|
-
const matchingResourceData = matchingResourceIndex >= 0 ? threadsForOwner[matchingResourceIndex] : undefined;
|
|
57
|
-
if (!matchingResourceData) {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const index = matchingResourceData.commentThreads.findIndex((commentThread) => commentThread.threadId === thread.threadId);
|
|
61
|
-
if (index >= 0) {
|
|
62
|
-
matchingResourceData.commentThreads[index] = ResourceWithCommentThreads.createCommentNode(owner, ( URI.parse(matchingResourceData.id)), thread);
|
|
63
|
-
}
|
|
64
|
-
else if (thread.comments && thread.comments.length) {
|
|
65
|
-
matchingResourceData.commentThreads.push(ResourceWithCommentThreads.createCommentNode(owner, ( URI.parse(matchingResourceData.id)), thread));
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
added.forEach(thread => {
|
|
69
|
-
const existingResource = threadsForOwner.filter(resourceWithThreads => ( resourceWithThreads.resource.toString()) === thread.resource);
|
|
70
|
-
if (existingResource.length) {
|
|
71
|
-
const resource = existingResource[0];
|
|
72
|
-
if (thread.comments && thread.comments.length) {
|
|
73
|
-
resource.commentThreads.push(ResourceWithCommentThreads.createCommentNode(owner, resource.resource, thread));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
threadsForOwner.push(( new ResourceWithCommentThreads(owner, ( URI.parse(thread.resource)), [thread])));
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
this.commentThreadsMap.set(owner, { ownerLabel, resourceWithCommentThreads: threadsForOwner });
|
|
81
|
-
this.updateResourceCommentThreads();
|
|
82
|
-
return removed.length > 0 || changed.length > 0 || added.length > 0;
|
|
83
|
-
}
|
|
84
|
-
hasCommentThreads() {
|
|
85
|
-
return !!this._resourceCommentThreads.length;
|
|
86
|
-
}
|
|
87
|
-
getMessage() {
|
|
88
|
-
if (!this._resourceCommentThreads.length) {
|
|
89
|
-
return ( localizeWithPath(
|
|
90
|
-
'vs/workbench/contrib/comments/browser/commentsModel',
|
|
91
|
-
'noComments',
|
|
92
|
-
"There are no comments in this workspace yet."
|
|
93
|
-
));
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
return '';
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
groupByResource(owner, commentThreads) {
|
|
100
|
-
const resourceCommentThreads = [];
|
|
101
|
-
const commentThreadsByResource = ( new Map());
|
|
102
|
-
for (const group of groupBy(commentThreads, CommentsModel._compareURIs)) {
|
|
103
|
-
commentThreadsByResource.set(group[0].resource, ( new ResourceWithCommentThreads(owner, ( URI.parse(group[0].resource)), group)));
|
|
104
|
-
}
|
|
105
|
-
commentThreadsByResource.forEach((v, i, m) => {
|
|
106
|
-
resourceCommentThreads.push(v);
|
|
107
|
-
});
|
|
108
|
-
return resourceCommentThreads;
|
|
109
|
-
}
|
|
110
|
-
static _compareURIs(a, b) {
|
|
111
|
-
const resourceA = ( a.resource.toString());
|
|
112
|
-
const resourceB = ( b.resource.toString());
|
|
113
|
-
if (resourceA < resourceB) {
|
|
114
|
-
return -1;
|
|
115
|
-
}
|
|
116
|
-
else if (resourceA > resourceB) {
|
|
117
|
-
return 1;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
return 0;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export { CommentsModel };
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { append, $ } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
-
import { renderMarkdown } from 'vscode/vscode/vs/base/browser/markdownRenderer';
|
|
5
|
-
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
7
|
-
import { CommentNode, ResourceWithCommentThreads } from '../common/commentModel.js';
|
|
8
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
9
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
10
|
-
import { IListService, WorkbenchObjectTree } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
11
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
12
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
13
|
-
import { TimestampWidget } from 'vscode/vscode/vs/workbench/contrib/comments/browser/timestamp';
|
|
14
|
-
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
15
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
16
|
-
import { commentViewThreadStateColorVar, getCommentThreadStateIconColor } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentColors';
|
|
17
|
-
import { CommentThreadState } from 'vscode/vscode/vs/editor/common/languages';
|
|
18
|
-
import { FilterOptions } from './commentsFilterOptions.js';
|
|
19
|
-
import { basename } from 'vscode/vscode/vs/base/common/resources';
|
|
20
|
-
import { openLinkFromMarkdown } from 'vscode/vscode/vs/editor/browser/widget/markdownRenderer/browser/markdownRenderer';
|
|
21
|
-
import { CommentsModel } from './commentsModel.js';
|
|
22
|
-
|
|
23
|
-
const COMMENTS_VIEW_ID = 'workbench.panel.comments';
|
|
24
|
-
const COMMENTS_VIEW_STORAGE_ID = 'Comments';
|
|
25
|
-
const COMMENTS_VIEW_TITLE = ( localize2WithPath(
|
|
26
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
27
|
-
'comments.view.title',
|
|
28
|
-
"Comments"
|
|
29
|
-
));
|
|
30
|
-
class CommentsModelVirualDelegate {
|
|
31
|
-
static { this.RESOURCE_ID = 'resource-with-comments'; }
|
|
32
|
-
static { this.COMMENT_ID = 'comment-node'; }
|
|
33
|
-
getHeight(element) {
|
|
34
|
-
if ((element instanceof CommentNode) && element.hasReply()) {
|
|
35
|
-
return 44;
|
|
36
|
-
}
|
|
37
|
-
return 22;
|
|
38
|
-
}
|
|
39
|
-
getTemplateId(element) {
|
|
40
|
-
if (element instanceof ResourceWithCommentThreads) {
|
|
41
|
-
return CommentsModelVirualDelegate.RESOURCE_ID;
|
|
42
|
-
}
|
|
43
|
-
if (element instanceof CommentNode) {
|
|
44
|
-
return CommentsModelVirualDelegate.COMMENT_ID;
|
|
45
|
-
}
|
|
46
|
-
return '';
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
class ResourceWithCommentsRenderer {
|
|
50
|
-
constructor(labels) {
|
|
51
|
-
this.labels = labels;
|
|
52
|
-
this.templateId = 'resource-with-comments';
|
|
53
|
-
}
|
|
54
|
-
renderTemplate(container) {
|
|
55
|
-
const labelContainer = append(container, $('.resource-container'));
|
|
56
|
-
const resourceLabel = this.labels.create(labelContainer);
|
|
57
|
-
const separator = append(labelContainer, $('.separator'));
|
|
58
|
-
const owner = labelContainer.appendChild($('.owner'));
|
|
59
|
-
return { resourceLabel, owner, separator };
|
|
60
|
-
}
|
|
61
|
-
renderElement(node, index, templateData, height) {
|
|
62
|
-
templateData.resourceLabel.setFile(node.element.resource);
|
|
63
|
-
templateData.separator.innerText = '\u00b7';
|
|
64
|
-
if (node.element.ownerLabel) {
|
|
65
|
-
templateData.owner.innerText = node.element.ownerLabel;
|
|
66
|
-
templateData.separator.style.display = 'inline';
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
templateData.owner.innerText = '';
|
|
70
|
-
templateData.separator.style.display = 'none';
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
disposeTemplate(templateData) {
|
|
74
|
-
templateData.resourceLabel.dispose();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
let CommentNodeRenderer = class CommentNodeRenderer {
|
|
78
|
-
constructor(openerService, configurationService, themeService) {
|
|
79
|
-
this.openerService = openerService;
|
|
80
|
-
this.configurationService = configurationService;
|
|
81
|
-
this.themeService = themeService;
|
|
82
|
-
this.templateId = 'comment-node';
|
|
83
|
-
}
|
|
84
|
-
renderTemplate(container) {
|
|
85
|
-
const threadContainer = append(container, $('.comment-thread-container'));
|
|
86
|
-
const metadataContainer = append(threadContainer, $('.comment-metadata-container'));
|
|
87
|
-
const threadMetadata = {
|
|
88
|
-
icon: append(metadataContainer, $('.icon')),
|
|
89
|
-
userNames: append(metadataContainer, $('.user')),
|
|
90
|
-
timestamp: ( new TimestampWidget(
|
|
91
|
-
this.configurationService,
|
|
92
|
-
append(metadataContainer, $('.timestamp-container'))
|
|
93
|
-
)),
|
|
94
|
-
separator: append(metadataContainer, $('.separator')),
|
|
95
|
-
commentPreview: append(metadataContainer, $('.text')),
|
|
96
|
-
range: append(metadataContainer, $('.range'))
|
|
97
|
-
};
|
|
98
|
-
threadMetadata.separator.innerText = '\u00b7';
|
|
99
|
-
const snippetContainer = append(threadContainer, $('.comment-snippet-container'));
|
|
100
|
-
const repliesMetadata = {
|
|
101
|
-
container: snippetContainer,
|
|
102
|
-
icon: append(snippetContainer, $('.icon')),
|
|
103
|
-
count: append(snippetContainer, $('.count')),
|
|
104
|
-
lastReplyDetail: append(snippetContainer, $('.reply-detail')),
|
|
105
|
-
separator: append(snippetContainer, $('.separator')),
|
|
106
|
-
timestamp: ( new TimestampWidget(
|
|
107
|
-
this.configurationService,
|
|
108
|
-
append(snippetContainer, $('.timestamp-container'))
|
|
109
|
-
)),
|
|
110
|
-
};
|
|
111
|
-
repliesMetadata.separator.innerText = '\u00b7';
|
|
112
|
-
repliesMetadata.icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.indent));
|
|
113
|
-
const disposables = [threadMetadata.timestamp, repliesMetadata.timestamp];
|
|
114
|
-
return { threadMetadata, repliesMetadata, disposables };
|
|
115
|
-
}
|
|
116
|
-
getCountString(commentCount) {
|
|
117
|
-
if (commentCount > 1) {
|
|
118
|
-
return ( localizeWithPath(
|
|
119
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
120
|
-
'commentsCount',
|
|
121
|
-
"{0} comments",
|
|
122
|
-
commentCount
|
|
123
|
-
));
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
return ( localizeWithPath(
|
|
127
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
128
|
-
'commentCount',
|
|
129
|
-
"1 comment"
|
|
130
|
-
));
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
getRenderedComment(commentBody, disposables) {
|
|
134
|
-
const renderedComment = renderMarkdown(commentBody, {
|
|
135
|
-
inline: true,
|
|
136
|
-
actionHandler: {
|
|
137
|
-
callback: (link) => openLinkFromMarkdown(this.openerService, link, commentBody.isTrusted),
|
|
138
|
-
disposables: disposables
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
const images = renderedComment.element.getElementsByTagName('img');
|
|
142
|
-
for (let i = 0; i < images.length; i++) {
|
|
143
|
-
const image = images[i];
|
|
144
|
-
const textDescription = $('');
|
|
145
|
-
textDescription.textContent = image.alt ? ( localizeWithPath(
|
|
146
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
147
|
-
'imageWithLabel',
|
|
148
|
-
"Image: {0}",
|
|
149
|
-
image.alt
|
|
150
|
-
)) : ( localizeWithPath(
|
|
151
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
152
|
-
'image',
|
|
153
|
-
"Image"
|
|
154
|
-
));
|
|
155
|
-
image.parentNode.replaceChild(textDescription, image);
|
|
156
|
-
}
|
|
157
|
-
return renderedComment;
|
|
158
|
-
}
|
|
159
|
-
getIcon(threadState) {
|
|
160
|
-
if (threadState === CommentThreadState.Unresolved) {
|
|
161
|
-
return Codicon.commentUnresolved;
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
return Codicon.comment;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
renderElement(node, index, templateData, height) {
|
|
168
|
-
const commentCount = node.element.replies.length + 1;
|
|
169
|
-
templateData.threadMetadata.icon.classList.remove(...Array.from(( templateData.threadMetadata.icon.classList.values()))
|
|
170
|
-
.filter(value => value.startsWith('codicon')));
|
|
171
|
-
templateData.threadMetadata.icon.classList.add(...ThemeIcon.asClassNameArray(this.getIcon(node.element.threadState)));
|
|
172
|
-
if (node.element.threadState !== undefined) {
|
|
173
|
-
const color = this.getCommentThreadWidgetStateColor(node.element.threadState, this.themeService.getColorTheme());
|
|
174
|
-
templateData.threadMetadata.icon.style.setProperty(commentViewThreadStateColorVar, `${color}`);
|
|
175
|
-
templateData.threadMetadata.icon.style.color = `var(${commentViewThreadStateColorVar})`;
|
|
176
|
-
}
|
|
177
|
-
templateData.threadMetadata.userNames.textContent = node.element.comment.userName;
|
|
178
|
-
templateData.threadMetadata.timestamp.setTimestamp(node.element.comment.timestamp ? ( new Date(node.element.comment.timestamp)) : undefined);
|
|
179
|
-
const originalComment = node.element;
|
|
180
|
-
templateData.threadMetadata.commentPreview.innerText = '';
|
|
181
|
-
templateData.threadMetadata.commentPreview.style.height = '22px';
|
|
182
|
-
if (typeof originalComment.comment.body === 'string') {
|
|
183
|
-
templateData.threadMetadata.commentPreview.innerText = originalComment.comment.body;
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
const disposables = ( new DisposableStore());
|
|
187
|
-
templateData.disposables.push(disposables);
|
|
188
|
-
const renderedComment = this.getRenderedComment(originalComment.comment.body, disposables);
|
|
189
|
-
templateData.disposables.push(renderedComment);
|
|
190
|
-
templateData.threadMetadata.commentPreview.appendChild(renderedComment.element.firstElementChild ?? renderedComment.element);
|
|
191
|
-
templateData.threadMetadata.commentPreview.title = renderedComment.element.textContent ?? '';
|
|
192
|
-
}
|
|
193
|
-
if (node.element.range) {
|
|
194
|
-
if (node.element.range.startLineNumber === node.element.range.endLineNumber) {
|
|
195
|
-
templateData.threadMetadata.range.textContent = ( localizeWithPath(
|
|
196
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
197
|
-
'commentLine',
|
|
198
|
-
"[Ln {0}]",
|
|
199
|
-
node.element.range.startLineNumber
|
|
200
|
-
));
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
templateData.threadMetadata.range.textContent = ( localizeWithPath(
|
|
204
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
205
|
-
'commentRange',
|
|
206
|
-
"[Ln {0}-{1}]",
|
|
207
|
-
node.element.range.startLineNumber,
|
|
208
|
-
node.element.range.endLineNumber
|
|
209
|
-
));
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (!node.element.hasReply()) {
|
|
213
|
-
templateData.repliesMetadata.container.style.display = 'none';
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
templateData.repliesMetadata.container.style.display = '';
|
|
217
|
-
templateData.repliesMetadata.count.textContent = this.getCountString(commentCount);
|
|
218
|
-
const lastComment = node.element.replies[node.element.replies.length - 1].comment;
|
|
219
|
-
templateData.repliesMetadata.lastReplyDetail.textContent = ( localizeWithPath(
|
|
220
|
-
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
221
|
-
'lastReplyFrom',
|
|
222
|
-
"Last reply from {0}",
|
|
223
|
-
lastComment.userName
|
|
224
|
-
));
|
|
225
|
-
templateData.repliesMetadata.timestamp.setTimestamp(lastComment.timestamp ? ( new Date(lastComment.timestamp)) : undefined);
|
|
226
|
-
}
|
|
227
|
-
getCommentThreadWidgetStateColor(state, theme) {
|
|
228
|
-
return (state !== undefined) ? getCommentThreadStateIconColor(state, theme) : undefined;
|
|
229
|
-
}
|
|
230
|
-
disposeTemplate(templateData) {
|
|
231
|
-
templateData.disposables.forEach(disposeable => disposeable.dispose());
|
|
232
|
-
}
|
|
233
|
-
};
|
|
234
|
-
CommentNodeRenderer = ( __decorate([
|
|
235
|
-
( __param(0, IOpenerService)),
|
|
236
|
-
( __param(1, IConfigurationService)),
|
|
237
|
-
( __param(2, IThemeService))
|
|
238
|
-
], CommentNodeRenderer));
|
|
239
|
-
class Filter {
|
|
240
|
-
constructor(options) {
|
|
241
|
-
this.options = options;
|
|
242
|
-
}
|
|
243
|
-
filter(element, parentVisibility) {
|
|
244
|
-
if (this.options.filter === '' && this.options.showResolved && this.options.showUnresolved) {
|
|
245
|
-
return 1 ;
|
|
246
|
-
}
|
|
247
|
-
if (element instanceof ResourceWithCommentThreads) {
|
|
248
|
-
return this.filterResourceMarkers(element);
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
return this.filterCommentNode(element, parentVisibility);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
filterResourceMarkers(resourceMarkers) {
|
|
255
|
-
if (this.options.textFilter.text && !this.options.textFilter.negate) {
|
|
256
|
-
const uriMatches = FilterOptions._filter(this.options.textFilter.text, basename(resourceMarkers.resource));
|
|
257
|
-
if (uriMatches) {
|
|
258
|
-
return { visibility: true, data: { type: 0 , uriMatches: uriMatches || [] } };
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return 2 ;
|
|
262
|
-
}
|
|
263
|
-
filterCommentNode(comment, parentVisibility) {
|
|
264
|
-
const matchesResolvedState = (comment.threadState === undefined) || (this.options.showResolved && CommentThreadState.Resolved === comment.threadState) ||
|
|
265
|
-
(this.options.showUnresolved && CommentThreadState.Unresolved === comment.threadState);
|
|
266
|
-
if (!matchesResolvedState) {
|
|
267
|
-
return false;
|
|
268
|
-
}
|
|
269
|
-
if (!this.options.textFilter.text) {
|
|
270
|
-
return true;
|
|
271
|
-
}
|
|
272
|
-
const textMatches =
|
|
273
|
-
FilterOptions._messageFilter(this.options.textFilter.text, typeof comment.comment.body === 'string' ? comment.comment.body : comment.comment.body.value)
|
|
274
|
-
|| FilterOptions._messageFilter(this.options.textFilter.text, comment.comment.userName)
|
|
275
|
-
|| ( comment.replies.map(reply => {
|
|
276
|
-
return FilterOptions._messageFilter(this.options.textFilter.text, reply.comment.userName)
|
|
277
|
-
|| FilterOptions._messageFilter(this.options.textFilter.text, typeof reply.comment.body === 'string' ? reply.comment.body : reply.comment.body.value);
|
|
278
|
-
})).filter(value => !!value).flat();
|
|
279
|
-
if (textMatches.length && !this.options.textFilter.negate) {
|
|
280
|
-
return { visibility: true, data: { type: 1 , textMatches } };
|
|
281
|
-
}
|
|
282
|
-
if (textMatches.length && this.options.textFilter.negate && parentVisibility === 2 ) {
|
|
283
|
-
return false;
|
|
284
|
-
}
|
|
285
|
-
if ((textMatches.length === 0) && this.options.textFilter.negate && parentVisibility === 2 ) {
|
|
286
|
-
return true;
|
|
287
|
-
}
|
|
288
|
-
return parentVisibility;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
let CommentsList = class CommentsList extends WorkbenchObjectTree {
|
|
292
|
-
constructor(labels, container, options, contextKeyService, listService, instantiationService, configurationService) {
|
|
293
|
-
const delegate = ( new CommentsModelVirualDelegate());
|
|
294
|
-
const renderers = [
|
|
295
|
-
instantiationService.createInstance(ResourceWithCommentsRenderer, labels),
|
|
296
|
-
instantiationService.createInstance(CommentNodeRenderer)
|
|
297
|
-
];
|
|
298
|
-
super('CommentsTree', container, delegate, renderers, {
|
|
299
|
-
accessibilityProvider: options.accessibilityProvider,
|
|
300
|
-
identityProvider: {
|
|
301
|
-
getId: (element) => {
|
|
302
|
-
if (element instanceof CommentsModel) {
|
|
303
|
-
return 'root';
|
|
304
|
-
}
|
|
305
|
-
if (element instanceof ResourceWithCommentThreads) {
|
|
306
|
-
return `${element.owner}-${element.id}`;
|
|
307
|
-
}
|
|
308
|
-
if (element instanceof CommentNode) {
|
|
309
|
-
return `${element.owner}-${( element.resource.toString())}-${element.threadId}-${element.comment.uniqueIdInThread}` + (element.isRoot ? '-root' : '');
|
|
310
|
-
}
|
|
311
|
-
return '';
|
|
312
|
-
}
|
|
313
|
-
},
|
|
314
|
-
expandOnlyOnTwistieClick: true,
|
|
315
|
-
collapseByDefault: false,
|
|
316
|
-
overrideStyles: options.overrideStyles,
|
|
317
|
-
filter: options.filter,
|
|
318
|
-
findWidgetEnabled: false
|
|
319
|
-
}, instantiationService, contextKeyService, listService, configurationService);
|
|
320
|
-
}
|
|
321
|
-
filterComments() {
|
|
322
|
-
this.refilter();
|
|
323
|
-
}
|
|
324
|
-
getVisibleItemCount() {
|
|
325
|
-
let filtered = 0;
|
|
326
|
-
const root = this.getNode();
|
|
327
|
-
for (const resourceNode of root.children) {
|
|
328
|
-
for (const commentNode of resourceNode.children) {
|
|
329
|
-
if (commentNode.visible && resourceNode.visible) {
|
|
330
|
-
filtered++;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
return filtered;
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
CommentsList = ( __decorate([
|
|
338
|
-
( __param(3, IContextKeyService)),
|
|
339
|
-
( __param(4, IListService)),
|
|
340
|
-
( __param(5, IInstantiationService)),
|
|
341
|
-
( __param(6, IConfigurationService))
|
|
342
|
-
], CommentsList));
|
|
343
|
-
|
|
344
|
-
export { COMMENTS_VIEW_ID, COMMENTS_VIEW_STORAGE_ID, COMMENTS_VIEW_TITLE, CommentNodeRenderer, CommentsList, Filter, ResourceWithCommentsRenderer };
|