@codingame/monaco-vscode-api 2.1.4 → 2.2.0-next.1
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/README.md +2 -0
- package/contributions.js +1 -0
- package/extensions.d.ts +6 -3
- package/extensions.js +18 -7
- package/lifecycle.js +11 -3
- package/missing-services.js +55 -10
- package/monaco.js +7 -3
- package/package.json +8 -8
- package/service-override/tools/views.d.ts +98 -0
- package/service-override/tools/views.js +249 -0
- package/services.d.ts +4 -2
- package/services.js +11 -9
- package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
- package/vscode/src/vs/base/browser/dom.js +18 -1
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
- package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
- package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
- package/vscode/src/vs/base/common/async.js +46 -2
- package/vscode/src/vs/base/common/codicons.d.ts +579 -0
- package/vscode/src/vs/base/common/event.js +11 -2
- package/vscode/src/vs/base/common/keybindingParser.js +87 -0
- package/vscode/src/vs/base/common/network.js +1 -2
- package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
- package/vscode/src/vs/base/common/platform.js +2 -1
- package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
- package/vscode/src/vs/platform/log/browser/log.js +24 -0
- package/vscode/src/vs/platform/product/common/product.js +1 -2
- package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
- package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
- package/vscode/src/vs/workbench/browser/window.js +239 -5
- package/vscode/src/vs/workbench/common/configuration.js +11 -1
- package/vscode/src/vs/workbench/common/theme.js +3 -3
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
- package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
- package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
- package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
- package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
- package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
- package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
- package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { matchesFuzzy2, matchesFuzzy } from '../../../../base/common/filters.js';
|
|
2
|
+
import { ltrim } from '../../../../base/common/strings.js';
|
|
3
|
+
class FilterOptions {
|
|
4
|
+
static { this._filter = matchesFuzzy2; }
|
|
5
|
+
static { this._messageFilter = matchesFuzzy; }
|
|
6
|
+
constructor(filter, showResolved, showUnresolved) {
|
|
7
|
+
this.filter = filter;
|
|
8
|
+
this.showResolved = true;
|
|
9
|
+
this.showUnresolved = true;
|
|
10
|
+
filter = filter.trim();
|
|
11
|
+
this.showResolved = showResolved;
|
|
12
|
+
this.showUnresolved = showUnresolved;
|
|
13
|
+
const negate = filter.startsWith('!');
|
|
14
|
+
this.textFilter = { text: (negate ? ltrim(filter, '!') : filter).trim(), negate };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { FilterOptions };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { groupBy } from '../../../../base/common/arrays.js';
|
|
2
|
+
import { URI } from '../../../../base/common/uri.js';
|
|
3
|
+
import { localizeWithPath } from '../../../../nls.js';
|
|
4
|
+
import { ResourceWithCommentThreads } from '../common/commentModel.js';
|
|
5
|
+
import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
6
|
+
class CommentsModel extends Disposable {
|
|
7
|
+
get resourceCommentThreads() { return this._resourceCommentThreads; }
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this._resourceCommentThreads = [];
|
|
11
|
+
this.commentThreadsMap = ( new Map());
|
|
12
|
+
}
|
|
13
|
+
updateResourceCommentThreads() {
|
|
14
|
+
const includeLabel = this.commentThreadsMap.size > 1;
|
|
15
|
+
this._resourceCommentThreads = ( [...( this.commentThreadsMap.values())].map(value => {
|
|
16
|
+
return ( value.resourceWithCommentThreads.map(resource => {
|
|
17
|
+
resource.ownerLabel = includeLabel ? value.ownerLabel : undefined;
|
|
18
|
+
return resource;
|
|
19
|
+
})).flat();
|
|
20
|
+
})).flat();
|
|
21
|
+
this._resourceCommentThreads.sort((a, b) => {
|
|
22
|
+
return ( a.resource.toString()) > ( b.resource.toString()) ? 1 : -1;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
setCommentThreads(owner, ownerLabel, commentThreads) {
|
|
26
|
+
this.commentThreadsMap.set(owner, { ownerLabel, resourceWithCommentThreads: this.groupByResource(owner, commentThreads) });
|
|
27
|
+
this.updateResourceCommentThreads();
|
|
28
|
+
}
|
|
29
|
+
deleteCommentsByOwner(owner) {
|
|
30
|
+
if (owner) {
|
|
31
|
+
const existingOwner = this.commentThreadsMap.get(owner);
|
|
32
|
+
this.commentThreadsMap.set(owner, { ownerLabel: existingOwner?.ownerLabel, resourceWithCommentThreads: [] });
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.commentThreadsMap.clear();
|
|
36
|
+
}
|
|
37
|
+
this.updateResourceCommentThreads();
|
|
38
|
+
}
|
|
39
|
+
updateCommentThreads(event) {
|
|
40
|
+
const { owner, ownerLabel, removed, changed, added } = event;
|
|
41
|
+
const threadsForOwner = this.commentThreadsMap.get(owner)?.resourceWithCommentThreads || [];
|
|
42
|
+
removed.forEach(thread => {
|
|
43
|
+
const matchingResourceIndex = threadsForOwner.findIndex((resourceData) => resourceData.id === thread.resource);
|
|
44
|
+
const matchingResourceData = matchingResourceIndex >= 0 ? threadsForOwner[matchingResourceIndex] : undefined;
|
|
45
|
+
const index = matchingResourceData?.commentThreads.findIndex((commentThread) => commentThread.threadId === thread.threadId) ?? 0;
|
|
46
|
+
if (index >= 0) {
|
|
47
|
+
matchingResourceData?.commentThreads.splice(index, 1);
|
|
48
|
+
}
|
|
49
|
+
if (matchingResourceData?.commentThreads.length === 0) {
|
|
50
|
+
threadsForOwner.splice(matchingResourceIndex, 1);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
changed.forEach(thread => {
|
|
54
|
+
const matchingResourceIndex = threadsForOwner.findIndex((resourceData) => resourceData.id === thread.resource);
|
|
55
|
+
const matchingResourceData = matchingResourceIndex >= 0 ? threadsForOwner[matchingResourceIndex] : undefined;
|
|
56
|
+
if (!matchingResourceData) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const index = matchingResourceData.commentThreads.findIndex((commentThread) => commentThread.threadId === thread.threadId);
|
|
60
|
+
if (index >= 0) {
|
|
61
|
+
matchingResourceData.commentThreads[index] = ResourceWithCommentThreads.createCommentNode(owner, ( URI.parse(matchingResourceData.id)), thread);
|
|
62
|
+
}
|
|
63
|
+
else if (thread.comments && thread.comments.length) {
|
|
64
|
+
matchingResourceData.commentThreads.push(ResourceWithCommentThreads.createCommentNode(owner, ( URI.parse(matchingResourceData.id)), thread));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
added.forEach(thread => {
|
|
68
|
+
const existingResource = threadsForOwner.filter(resourceWithThreads => ( resourceWithThreads.resource.toString()) === thread.resource);
|
|
69
|
+
if (existingResource.length) {
|
|
70
|
+
const resource = existingResource[0];
|
|
71
|
+
if (thread.comments && thread.comments.length) {
|
|
72
|
+
resource.commentThreads.push(ResourceWithCommentThreads.createCommentNode(owner, resource.resource, thread));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
threadsForOwner.push(( new ResourceWithCommentThreads(owner, ( URI.parse(thread.resource)), [thread])));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
this.commentThreadsMap.set(owner, { ownerLabel, resourceWithCommentThreads: threadsForOwner });
|
|
80
|
+
this.updateResourceCommentThreads();
|
|
81
|
+
return removed.length > 0 || changed.length > 0 || added.length > 0;
|
|
82
|
+
}
|
|
83
|
+
hasCommentThreads() {
|
|
84
|
+
return !!this._resourceCommentThreads.length;
|
|
85
|
+
}
|
|
86
|
+
getMessage() {
|
|
87
|
+
if (!this._resourceCommentThreads.length) {
|
|
88
|
+
return ( localizeWithPath(
|
|
89
|
+
'vs/workbench/contrib/comments/browser/commentsModel',
|
|
90
|
+
'noComments',
|
|
91
|
+
"There are no comments in this workspace yet."
|
|
92
|
+
));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return '';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
groupByResource(owner, commentThreads) {
|
|
99
|
+
const resourceCommentThreads = [];
|
|
100
|
+
const commentThreadsByResource = ( new Map());
|
|
101
|
+
for (const group of groupBy(commentThreads, CommentsModel._compareURIs)) {
|
|
102
|
+
commentThreadsByResource.set(group[0].resource, ( new ResourceWithCommentThreads(owner, ( URI.parse(group[0].resource)), group)));
|
|
103
|
+
}
|
|
104
|
+
commentThreadsByResource.forEach((v, i, m) => {
|
|
105
|
+
resourceCommentThreads.push(v);
|
|
106
|
+
});
|
|
107
|
+
return resourceCommentThreads;
|
|
108
|
+
}
|
|
109
|
+
static _compareURIs(a, b) {
|
|
110
|
+
const resourceA = ( a.resource.toString());
|
|
111
|
+
const resourceB = ( b.resource.toString());
|
|
112
|
+
if (resourceA < resourceB) {
|
|
113
|
+
return -1;
|
|
114
|
+
}
|
|
115
|
+
else if (resourceA > resourceB) {
|
|
116
|
+
return 1;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export { CommentsModel };
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { append, $ } from '../../../../base/browser/dom.js';
|
|
3
|
+
import { localize2WithPath, localizeWithPath } from '../../../../nls.js';
|
|
4
|
+
import { renderMarkdown } from '../../../../base/browser/markdownRenderer.js';
|
|
5
|
+
import { DisposableStore } from '../../../../base/common/lifecycle.js';
|
|
6
|
+
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
|
|
7
|
+
import { CommentNode, ResourceWithCommentThreads } from '../common/commentModel.js';
|
|
8
|
+
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
|
9
|
+
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
10
|
+
import { WorkbenchObjectTree, IListService } from '../../../../platform/list/browser/listService.js';
|
|
11
|
+
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
|
|
12
|
+
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
13
|
+
import { TimestampWidget } from './timestamp.js';
|
|
14
|
+
import { Codicon } from '../../../../base/common/codicons.js';
|
|
15
|
+
import { ThemeIcon } from '../../../../base/common/themables.js';
|
|
16
|
+
import { commentViewThreadStateColorVar, getCommentThreadStateIconColor } from './commentColors.js';
|
|
17
|
+
import { CommentThreadState } from '../../../../editor/common/languages.js';
|
|
18
|
+
import { FilterOptions } from './commentsFilterOptions.js';
|
|
19
|
+
import { basename } from '../../../../base/common/resources.js';
|
|
20
|
+
import { openLinkFromMarkdown } from '../../../../editor/browser/widget/markdownRenderer/browser/markdownRenderer.js';
|
|
21
|
+
import { CommentsModel } from './commentsModel.js';
|
|
22
|
+
const COMMENTS_VIEW_ID = 'workbench.panel.comments';
|
|
23
|
+
const COMMENTS_VIEW_STORAGE_ID = 'Comments';
|
|
24
|
+
const COMMENTS_VIEW_TITLE = ( localize2WithPath(
|
|
25
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
26
|
+
'comments.view.title',
|
|
27
|
+
"Comments"
|
|
28
|
+
));
|
|
29
|
+
class CommentsModelVirualDelegate {
|
|
30
|
+
static { this.RESOURCE_ID = 'resource-with-comments'; }
|
|
31
|
+
static { this.COMMENT_ID = 'comment-node'; }
|
|
32
|
+
getHeight(element) {
|
|
33
|
+
if ((element instanceof CommentNode) && element.hasReply()) {
|
|
34
|
+
return 44;
|
|
35
|
+
}
|
|
36
|
+
return 22;
|
|
37
|
+
}
|
|
38
|
+
getTemplateId(element) {
|
|
39
|
+
if (element instanceof ResourceWithCommentThreads) {
|
|
40
|
+
return CommentsModelVirualDelegate.RESOURCE_ID;
|
|
41
|
+
}
|
|
42
|
+
if (element instanceof CommentNode) {
|
|
43
|
+
return CommentsModelVirualDelegate.COMMENT_ID;
|
|
44
|
+
}
|
|
45
|
+
return '';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
class ResourceWithCommentsRenderer {
|
|
49
|
+
constructor(labels) {
|
|
50
|
+
this.labels = labels;
|
|
51
|
+
this.templateId = 'resource-with-comments';
|
|
52
|
+
}
|
|
53
|
+
renderTemplate(container) {
|
|
54
|
+
const labelContainer = append(container, $('.resource-container'));
|
|
55
|
+
const resourceLabel = this.labels.create(labelContainer);
|
|
56
|
+
const separator = append(labelContainer, $('.separator'));
|
|
57
|
+
const owner = labelContainer.appendChild($('.owner'));
|
|
58
|
+
return { resourceLabel, owner, separator };
|
|
59
|
+
}
|
|
60
|
+
renderElement(node, index, templateData, height) {
|
|
61
|
+
templateData.resourceLabel.setFile(node.element.resource);
|
|
62
|
+
templateData.separator.innerText = '\u00b7';
|
|
63
|
+
if (node.element.ownerLabel) {
|
|
64
|
+
templateData.owner.innerText = node.element.ownerLabel;
|
|
65
|
+
templateData.separator.style.display = 'inline';
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
templateData.owner.innerText = '';
|
|
69
|
+
templateData.separator.style.display = 'none';
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
disposeTemplate(templateData) {
|
|
73
|
+
templateData.resourceLabel.dispose();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
let CommentNodeRenderer = class CommentNodeRenderer {
|
|
77
|
+
constructor(openerService, configurationService, themeService) {
|
|
78
|
+
this.openerService = openerService;
|
|
79
|
+
this.configurationService = configurationService;
|
|
80
|
+
this.themeService = themeService;
|
|
81
|
+
this.templateId = 'comment-node';
|
|
82
|
+
}
|
|
83
|
+
renderTemplate(container) {
|
|
84
|
+
const threadContainer = append(container, $('.comment-thread-container'));
|
|
85
|
+
const metadataContainer = append(threadContainer, $('.comment-metadata-container'));
|
|
86
|
+
const threadMetadata = {
|
|
87
|
+
icon: append(metadataContainer, $('.icon')),
|
|
88
|
+
userNames: append(metadataContainer, $('.user')),
|
|
89
|
+
timestamp: ( new TimestampWidget(
|
|
90
|
+
this.configurationService,
|
|
91
|
+
append(metadataContainer, $('.timestamp-container'))
|
|
92
|
+
)),
|
|
93
|
+
separator: append(metadataContainer, $('.separator')),
|
|
94
|
+
commentPreview: append(metadataContainer, $('.text')),
|
|
95
|
+
range: append(metadataContainer, $('.range'))
|
|
96
|
+
};
|
|
97
|
+
threadMetadata.separator.innerText = '\u00b7';
|
|
98
|
+
const snippetContainer = append(threadContainer, $('.comment-snippet-container'));
|
|
99
|
+
const repliesMetadata = {
|
|
100
|
+
container: snippetContainer,
|
|
101
|
+
icon: append(snippetContainer, $('.icon')),
|
|
102
|
+
count: append(snippetContainer, $('.count')),
|
|
103
|
+
lastReplyDetail: append(snippetContainer, $('.reply-detail')),
|
|
104
|
+
separator: append(snippetContainer, $('.separator')),
|
|
105
|
+
timestamp: ( new TimestampWidget(
|
|
106
|
+
this.configurationService,
|
|
107
|
+
append(snippetContainer, $('.timestamp-container'))
|
|
108
|
+
)),
|
|
109
|
+
};
|
|
110
|
+
repliesMetadata.separator.innerText = '\u00b7';
|
|
111
|
+
repliesMetadata.icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.indent));
|
|
112
|
+
const disposables = [threadMetadata.timestamp, repliesMetadata.timestamp];
|
|
113
|
+
return { threadMetadata, repliesMetadata, disposables };
|
|
114
|
+
}
|
|
115
|
+
getCountString(commentCount) {
|
|
116
|
+
if (commentCount > 1) {
|
|
117
|
+
return ( localizeWithPath(
|
|
118
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
119
|
+
'commentsCount',
|
|
120
|
+
"{0} comments",
|
|
121
|
+
commentCount
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
return ( localizeWithPath(
|
|
126
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
127
|
+
'commentCount',
|
|
128
|
+
"1 comment"
|
|
129
|
+
));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
getRenderedComment(commentBody, disposables) {
|
|
133
|
+
const renderedComment = renderMarkdown(commentBody, {
|
|
134
|
+
inline: true,
|
|
135
|
+
actionHandler: {
|
|
136
|
+
callback: (link) => openLinkFromMarkdown(this.openerService, link, commentBody.isTrusted),
|
|
137
|
+
disposables: disposables
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const images = renderedComment.element.getElementsByTagName('img');
|
|
141
|
+
for (let i = 0; i < images.length; i++) {
|
|
142
|
+
const image = images[i];
|
|
143
|
+
const textDescription = $('');
|
|
144
|
+
textDescription.textContent = image.alt ? ( localizeWithPath(
|
|
145
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
146
|
+
'imageWithLabel',
|
|
147
|
+
"Image: {0}",
|
|
148
|
+
image.alt
|
|
149
|
+
)) : ( localizeWithPath(
|
|
150
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
151
|
+
'image',
|
|
152
|
+
"Image"
|
|
153
|
+
));
|
|
154
|
+
image.parentNode.replaceChild(textDescription, image);
|
|
155
|
+
}
|
|
156
|
+
return renderedComment;
|
|
157
|
+
}
|
|
158
|
+
getIcon(threadState) {
|
|
159
|
+
if (threadState === CommentThreadState.Unresolved) {
|
|
160
|
+
return Codicon.commentUnresolved;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
return Codicon.comment;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
renderElement(node, index, templateData, height) {
|
|
167
|
+
const commentCount = node.element.replies.length + 1;
|
|
168
|
+
templateData.threadMetadata.icon.classList.remove(...Array.from(( templateData.threadMetadata.icon.classList.values()))
|
|
169
|
+
.filter(value => value.startsWith('codicon')));
|
|
170
|
+
templateData.threadMetadata.icon.classList.add(...ThemeIcon.asClassNameArray(this.getIcon(node.element.threadState)));
|
|
171
|
+
if (node.element.threadState !== undefined) {
|
|
172
|
+
const color = this.getCommentThreadWidgetStateColor(node.element.threadState, this.themeService.getColorTheme());
|
|
173
|
+
templateData.threadMetadata.icon.style.setProperty(commentViewThreadStateColorVar, `${color}`);
|
|
174
|
+
templateData.threadMetadata.icon.style.color = `var(${commentViewThreadStateColorVar})`;
|
|
175
|
+
}
|
|
176
|
+
templateData.threadMetadata.userNames.textContent = node.element.comment.userName;
|
|
177
|
+
templateData.threadMetadata.timestamp.setTimestamp(node.element.comment.timestamp ? ( new Date(node.element.comment.timestamp)) : undefined);
|
|
178
|
+
const originalComment = node.element;
|
|
179
|
+
templateData.threadMetadata.commentPreview.innerText = '';
|
|
180
|
+
templateData.threadMetadata.commentPreview.style.height = '22px';
|
|
181
|
+
if (typeof originalComment.comment.body === 'string') {
|
|
182
|
+
templateData.threadMetadata.commentPreview.innerText = originalComment.comment.body;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
const disposables = ( new DisposableStore());
|
|
186
|
+
templateData.disposables.push(disposables);
|
|
187
|
+
const renderedComment = this.getRenderedComment(originalComment.comment.body, disposables);
|
|
188
|
+
templateData.disposables.push(renderedComment);
|
|
189
|
+
templateData.threadMetadata.commentPreview.appendChild(renderedComment.element.firstElementChild ?? renderedComment.element);
|
|
190
|
+
templateData.threadMetadata.commentPreview.title = renderedComment.element.textContent ?? '';
|
|
191
|
+
}
|
|
192
|
+
if (node.element.range) {
|
|
193
|
+
if (node.element.range.startLineNumber === node.element.range.endLineNumber) {
|
|
194
|
+
templateData.threadMetadata.range.textContent = ( localizeWithPath(
|
|
195
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
196
|
+
'commentLine',
|
|
197
|
+
"[Ln {0}]",
|
|
198
|
+
node.element.range.startLineNumber
|
|
199
|
+
));
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
templateData.threadMetadata.range.textContent = ( localizeWithPath(
|
|
203
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
204
|
+
'commentRange',
|
|
205
|
+
"[Ln {0}-{1}]",
|
|
206
|
+
node.element.range.startLineNumber,
|
|
207
|
+
node.element.range.endLineNumber
|
|
208
|
+
));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (!node.element.hasReply()) {
|
|
212
|
+
templateData.repliesMetadata.container.style.display = 'none';
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
templateData.repliesMetadata.container.style.display = '';
|
|
216
|
+
templateData.repliesMetadata.count.textContent = this.getCountString(commentCount);
|
|
217
|
+
const lastComment = node.element.replies[node.element.replies.length - 1].comment;
|
|
218
|
+
templateData.repliesMetadata.lastReplyDetail.textContent = ( localizeWithPath(
|
|
219
|
+
'vs/workbench/contrib/comments/browser/commentsTreeViewer',
|
|
220
|
+
'lastReplyFrom',
|
|
221
|
+
"Last reply from {0}",
|
|
222
|
+
lastComment.userName
|
|
223
|
+
));
|
|
224
|
+
templateData.repliesMetadata.timestamp.setTimestamp(lastComment.timestamp ? ( new Date(lastComment.timestamp)) : undefined);
|
|
225
|
+
}
|
|
226
|
+
getCommentThreadWidgetStateColor(state, theme) {
|
|
227
|
+
return (state !== undefined) ? getCommentThreadStateIconColor(state, theme) : undefined;
|
|
228
|
+
}
|
|
229
|
+
disposeTemplate(templateData) {
|
|
230
|
+
templateData.disposables.forEach(disposeable => disposeable.dispose());
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
CommentNodeRenderer = ( __decorate([
|
|
234
|
+
( __param(0, IOpenerService)),
|
|
235
|
+
( __param(1, IConfigurationService)),
|
|
236
|
+
( __param(2, IThemeService))
|
|
237
|
+
], CommentNodeRenderer));
|
|
238
|
+
class Filter {
|
|
239
|
+
constructor(options) {
|
|
240
|
+
this.options = options;
|
|
241
|
+
}
|
|
242
|
+
filter(element, parentVisibility) {
|
|
243
|
+
if (this.options.filter === '' && this.options.showResolved && this.options.showUnresolved) {
|
|
244
|
+
return 1 ;
|
|
245
|
+
}
|
|
246
|
+
if (element instanceof ResourceWithCommentThreads) {
|
|
247
|
+
return this.filterResourceMarkers(element);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
return this.filterCommentNode(element, parentVisibility);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
filterResourceMarkers(resourceMarkers) {
|
|
254
|
+
if (this.options.textFilter.text && !this.options.textFilter.negate) {
|
|
255
|
+
const uriMatches = FilterOptions._filter(this.options.textFilter.text, basename(resourceMarkers.resource));
|
|
256
|
+
if (uriMatches) {
|
|
257
|
+
return { visibility: true, data: { type: 0 , uriMatches: uriMatches || [] } };
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return 2 ;
|
|
261
|
+
}
|
|
262
|
+
filterCommentNode(comment, parentVisibility) {
|
|
263
|
+
const matchesResolvedState = (comment.threadState === undefined) || (this.options.showResolved && CommentThreadState.Resolved === comment.threadState) ||
|
|
264
|
+
(this.options.showUnresolved && CommentThreadState.Unresolved === comment.threadState);
|
|
265
|
+
if (!matchesResolvedState) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
if (!this.options.textFilter.text) {
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
const textMatches =
|
|
272
|
+
FilterOptions._messageFilter(this.options.textFilter.text, typeof comment.comment.body === 'string' ? comment.comment.body : comment.comment.body.value)
|
|
273
|
+
|| FilterOptions._messageFilter(this.options.textFilter.text, comment.comment.userName)
|
|
274
|
+
|| ( comment.replies.map(reply => {
|
|
275
|
+
return FilterOptions._messageFilter(this.options.textFilter.text, reply.comment.userName)
|
|
276
|
+
|| FilterOptions._messageFilter(this.options.textFilter.text, typeof reply.comment.body === 'string' ? reply.comment.body : reply.comment.body.value);
|
|
277
|
+
})).filter(value => !!value).flat();
|
|
278
|
+
if (textMatches.length && !this.options.textFilter.negate) {
|
|
279
|
+
return { visibility: true, data: { type: 1 , textMatches } };
|
|
280
|
+
}
|
|
281
|
+
if (textMatches.length && this.options.textFilter.negate && parentVisibility === 2 ) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
if ((textMatches.length === 0) && this.options.textFilter.negate && parentVisibility === 2 ) {
|
|
285
|
+
return true;
|
|
286
|
+
}
|
|
287
|
+
return parentVisibility;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
let CommentsList = class CommentsList extends WorkbenchObjectTree {
|
|
291
|
+
constructor(labels, container, options, contextKeyService, listService, instantiationService, configurationService) {
|
|
292
|
+
const delegate = ( new CommentsModelVirualDelegate());
|
|
293
|
+
const renderers = [
|
|
294
|
+
instantiationService.createInstance(ResourceWithCommentsRenderer, labels),
|
|
295
|
+
instantiationService.createInstance(CommentNodeRenderer)
|
|
296
|
+
];
|
|
297
|
+
super('CommentsTree', container, delegate, renderers, {
|
|
298
|
+
accessibilityProvider: options.accessibilityProvider,
|
|
299
|
+
identityProvider: {
|
|
300
|
+
getId: (element) => {
|
|
301
|
+
if (element instanceof CommentsModel) {
|
|
302
|
+
return 'root';
|
|
303
|
+
}
|
|
304
|
+
if (element instanceof ResourceWithCommentThreads) {
|
|
305
|
+
return `${element.owner}-${element.id}`;
|
|
306
|
+
}
|
|
307
|
+
if (element instanceof CommentNode) {
|
|
308
|
+
return `${element.owner}-${( element.resource.toString())}-${element.threadId}-${element.comment.uniqueIdInThread}` + (element.isRoot ? '-root' : '');
|
|
309
|
+
}
|
|
310
|
+
return '';
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
expandOnlyOnTwistieClick: true,
|
|
314
|
+
collapseByDefault: false,
|
|
315
|
+
overrideStyles: options.overrideStyles,
|
|
316
|
+
filter: options.filter,
|
|
317
|
+
findWidgetEnabled: false
|
|
318
|
+
}, instantiationService, contextKeyService, listService, configurationService);
|
|
319
|
+
}
|
|
320
|
+
filterComments() {
|
|
321
|
+
this.refilter();
|
|
322
|
+
}
|
|
323
|
+
getVisibleItemCount() {
|
|
324
|
+
let filtered = 0;
|
|
325
|
+
const root = this.getNode();
|
|
326
|
+
for (const resourceNode of root.children) {
|
|
327
|
+
for (const commentNode of resourceNode.children) {
|
|
328
|
+
if (commentNode.visible && resourceNode.visible) {
|
|
329
|
+
filtered++;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return filtered;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
CommentsList = ( __decorate([
|
|
337
|
+
( __param(3, IContextKeyService)),
|
|
338
|
+
( __param(4, IListService)),
|
|
339
|
+
( __param(5, IInstantiationService)),
|
|
340
|
+
( __param(6, IConfigurationService))
|
|
341
|
+
], CommentsList));
|
|
342
|
+
export { COMMENTS_VIEW_ID, COMMENTS_VIEW_STORAGE_ID, COMMENTS_VIEW_TITLE, CommentNodeRenderer, CommentsList, Filter, ResourceWithCommentsRenderer };
|