@codingame/monaco-vscode-comments-service-override 4.4.1 → 4.5.0-improve-code-splitting.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/comments.js +2 -1
- package/package.json +10 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +46 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +355 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js +6 -4
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsEditorContribution.js +3 -3
package/comments.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import { ICommentService
|
|
2
|
+
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService.service';
|
|
3
|
+
import { CommentService } from './vscode/src/vs/workbench/contrib/comments/browser/commentService.js';
|
|
3
4
|
import './vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js';
|
|
4
5
|
|
|
5
6
|
function getServiceOverride() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-comments-service-override",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-improve-code-splitting.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -17,7 +17,15 @@
|
|
|
17
17
|
"main": "index.js",
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"default": "./index.js"
|
|
23
|
+
},
|
|
24
|
+
"./vscode/*": {
|
|
25
|
+
"default": "./vscode/src/*.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
20
28
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.5.0-improve-code-splitting.1"
|
|
22
30
|
}
|
|
23
31
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
|
+
import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
|
|
4
|
+
import { createAndFillInContextMenuActions } from 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
5
|
+
|
|
6
|
+
let CommentMenus = class CommentMenus {
|
|
7
|
+
constructor(menuService) {
|
|
8
|
+
this.menuService = menuService;
|
|
9
|
+
}
|
|
10
|
+
getCommentThreadTitleActions(contextKeyService) {
|
|
11
|
+
return this.getMenu(MenuId.CommentThreadTitle, contextKeyService);
|
|
12
|
+
}
|
|
13
|
+
getCommentThreadActions(contextKeyService) {
|
|
14
|
+
return this.getMenu(MenuId.CommentThreadActions, contextKeyService);
|
|
15
|
+
}
|
|
16
|
+
getCommentEditorActions(contextKeyService) {
|
|
17
|
+
return this.getMenu(MenuId.CommentEditorActions, contextKeyService);
|
|
18
|
+
}
|
|
19
|
+
getCommentThreadAdditionalActions(contextKeyService) {
|
|
20
|
+
return this.getMenu(MenuId.CommentThreadAdditionalActions, contextKeyService);
|
|
21
|
+
}
|
|
22
|
+
getCommentTitleActions(comment, contextKeyService) {
|
|
23
|
+
return this.getMenu(MenuId.CommentTitle, contextKeyService);
|
|
24
|
+
}
|
|
25
|
+
getCommentActions(comment, contextKeyService) {
|
|
26
|
+
return this.getMenu(MenuId.CommentActions, contextKeyService);
|
|
27
|
+
}
|
|
28
|
+
getCommentThreadTitleContextActions(contextKeyService) {
|
|
29
|
+
return this.getMenu(MenuId.CommentThreadTitleContext, contextKeyService);
|
|
30
|
+
}
|
|
31
|
+
getMenu(menuId, contextKeyService) {
|
|
32
|
+
const menu = this.menuService.createMenu(menuId, contextKeyService);
|
|
33
|
+
const primary = [];
|
|
34
|
+
const secondary = [];
|
|
35
|
+
const result = { primary, secondary };
|
|
36
|
+
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, result, 'inline');
|
|
37
|
+
return menu;
|
|
38
|
+
}
|
|
39
|
+
dispose() {
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
CommentMenus = ( __decorate([
|
|
43
|
+
( __param(0, IMenuService))
|
|
44
|
+
], CommentMenus));
|
|
45
|
+
|
|
46
|
+
export { CommentMenus };
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
3
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
6
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
7
|
+
import { CommentMenus } from './commentMenus.js';
|
|
8
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
9
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
|
+
import { COMMENTS_SECTION } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentsConfiguration';
|
|
11
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
12
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
13
|
+
import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
|
|
14
|
+
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
15
|
+
import { CommentsModel } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsModel';
|
|
16
|
+
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
17
|
+
|
|
18
|
+
const CONTINUE_ON_COMMENTS = 'comments.continueOnComments';
|
|
19
|
+
let CommentService = class CommentService extends Disposable {
|
|
20
|
+
constructor(instantiationService, layoutService, configurationService, contextKeyService, storageService, logService, modelService) {
|
|
21
|
+
super();
|
|
22
|
+
this.instantiationService = instantiationService;
|
|
23
|
+
this.layoutService = layoutService;
|
|
24
|
+
this.configurationService = configurationService;
|
|
25
|
+
this.storageService = storageService;
|
|
26
|
+
this.logService = logService;
|
|
27
|
+
this.modelService = modelService;
|
|
28
|
+
this._onDidSetDataProvider = this._register(( new Emitter()));
|
|
29
|
+
this.onDidSetDataProvider = this._onDidSetDataProvider.event;
|
|
30
|
+
this._onDidDeleteDataProvider = this._register(( new Emitter()));
|
|
31
|
+
this.onDidDeleteDataProvider = this._onDidDeleteDataProvider.event;
|
|
32
|
+
this._onDidSetResourceCommentInfos = this._register(( new Emitter()));
|
|
33
|
+
this.onDidSetResourceCommentInfos = this._onDidSetResourceCommentInfos.event;
|
|
34
|
+
this._onDidSetAllCommentThreads = this._register(( new Emitter()));
|
|
35
|
+
this.onDidSetAllCommentThreads = this._onDidSetAllCommentThreads.event;
|
|
36
|
+
this._onDidUpdateCommentThreads = this._register(( new Emitter()));
|
|
37
|
+
this.onDidUpdateCommentThreads = this._onDidUpdateCommentThreads.event;
|
|
38
|
+
this._onDidUpdateNotebookCommentThreads = this._register(( new Emitter()));
|
|
39
|
+
this.onDidUpdateNotebookCommentThreads = this._onDidUpdateNotebookCommentThreads.event;
|
|
40
|
+
this._onDidUpdateCommentingRanges = this._register(( new Emitter()));
|
|
41
|
+
this.onDidUpdateCommentingRanges = this._onDidUpdateCommentingRanges.event;
|
|
42
|
+
this._onDidChangeActiveEditingCommentThread = this._register(( new Emitter()));
|
|
43
|
+
this.onDidChangeActiveEditingCommentThread = this._onDidChangeActiveEditingCommentThread.event;
|
|
44
|
+
this._onDidChangeCurrentCommentThread = this._register(( new Emitter()));
|
|
45
|
+
this.onDidChangeCurrentCommentThread = this._onDidChangeCurrentCommentThread.event;
|
|
46
|
+
this._onDidChangeCommentingEnabled = this._register(( new Emitter()));
|
|
47
|
+
this.onDidChangeCommentingEnabled = this._onDidChangeCommentingEnabled.event;
|
|
48
|
+
this._onDidChangeActiveCommentingRange = this._register(( new Emitter()));
|
|
49
|
+
this.onDidChangeActiveCommentingRange = this._onDidChangeActiveCommentingRange.event;
|
|
50
|
+
this._commentControls = ( new Map());
|
|
51
|
+
this._commentMenus = ( new Map());
|
|
52
|
+
this._isCommentingEnabled = true;
|
|
53
|
+
this._continueOnComments = ( new Map());
|
|
54
|
+
this._continueOnCommentProviders = ( new Set());
|
|
55
|
+
this._commentsModel = this._register(( new CommentsModel()));
|
|
56
|
+
this.commentsModel = this._commentsModel;
|
|
57
|
+
this._commentingRangeResources = ( new Set());
|
|
58
|
+
this._commentingRangeResourceHintSchemes = ( new Set());
|
|
59
|
+
this._handleConfiguration();
|
|
60
|
+
this._handleZenMode();
|
|
61
|
+
this._workspaceHasCommenting = CommentContextKeys.WorkspaceHasCommenting.bindTo(contextKeyService);
|
|
62
|
+
const storageListener = this._register(( new DisposableStore()));
|
|
63
|
+
const storageEvent = Event.debounce(this.storageService.onDidChangeValue(1 , CONTINUE_ON_COMMENTS, storageListener), (last, event) => last?.external ? last : event, 500);
|
|
64
|
+
storageListener.add(storageEvent(v => {
|
|
65
|
+
if (!v.external) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const commentsToRestore = this.storageService.getObject(CONTINUE_ON_COMMENTS, 1 );
|
|
69
|
+
if (!commentsToRestore) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.logService.debug(`Comments: URIs of continue on comments from storage ${( commentsToRestore.map(thread => ( thread.uri.toString()))).join(', ')}.`);
|
|
73
|
+
const changedOwners = this._addContinueOnComments(commentsToRestore, this._continueOnComments);
|
|
74
|
+
for (const uniqueOwner of changedOwners) {
|
|
75
|
+
const control = this._commentControls.get(uniqueOwner);
|
|
76
|
+
if (!control) {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const evt = {
|
|
80
|
+
uniqueOwner: uniqueOwner,
|
|
81
|
+
owner: control.owner,
|
|
82
|
+
ownerLabel: control.label,
|
|
83
|
+
pending: this._continueOnComments.get(uniqueOwner) || [],
|
|
84
|
+
added: [],
|
|
85
|
+
removed: [],
|
|
86
|
+
changed: []
|
|
87
|
+
};
|
|
88
|
+
this.updateModelThreads(evt);
|
|
89
|
+
}
|
|
90
|
+
}));
|
|
91
|
+
this._register(storageService.onWillSaveState(() => {
|
|
92
|
+
const map = ( new Map());
|
|
93
|
+
for (const provider of this._continueOnCommentProviders) {
|
|
94
|
+
const pendingComments = provider.provideContinueOnComments();
|
|
95
|
+
this._addContinueOnComments(pendingComments, map);
|
|
96
|
+
}
|
|
97
|
+
this._saveContinueOnComments(map);
|
|
98
|
+
}));
|
|
99
|
+
this._register(this.modelService.onModelAdded(model => {
|
|
100
|
+
if (!( this._commentingRangeResources.has(( model.uri.toString())))) {
|
|
101
|
+
this.getDocumentComments(model.uri);
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
_updateResourcesWithCommentingRanges(resource, commentInfos) {
|
|
106
|
+
for (const comments of commentInfos) {
|
|
107
|
+
if (comments && (comments.commentingRanges.ranges.length > 0 || comments.threads.length > 0)) {
|
|
108
|
+
this._commentingRangeResources.add(( resource.toString()));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
_handleConfiguration() {
|
|
113
|
+
this._isCommentingEnabled = this._defaultCommentingEnablement;
|
|
114
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
115
|
+
if (e.affectsConfiguration('comments.visible')) {
|
|
116
|
+
this.enableCommenting(this._defaultCommentingEnablement);
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
}
|
|
120
|
+
_handleZenMode() {
|
|
121
|
+
let preZenModeValue = this._isCommentingEnabled;
|
|
122
|
+
this._register(this.layoutService.onDidChangeZenMode(e => {
|
|
123
|
+
if (e) {
|
|
124
|
+
preZenModeValue = this._isCommentingEnabled;
|
|
125
|
+
this.enableCommenting(false);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
this.enableCommenting(preZenModeValue);
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
get _defaultCommentingEnablement() {
|
|
133
|
+
return !!this.configurationService.getValue(COMMENTS_SECTION)?.visible;
|
|
134
|
+
}
|
|
135
|
+
get isCommentingEnabled() {
|
|
136
|
+
return this._isCommentingEnabled;
|
|
137
|
+
}
|
|
138
|
+
enableCommenting(enable) {
|
|
139
|
+
if (enable !== this._isCommentingEnabled) {
|
|
140
|
+
this._isCommentingEnabled = enable;
|
|
141
|
+
this._onDidChangeCommentingEnabled.fire(enable);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
setCurrentCommentThread(commentThread) {
|
|
145
|
+
this._onDidChangeCurrentCommentThread.fire(commentThread);
|
|
146
|
+
}
|
|
147
|
+
setActiveEditingCommentThread(commentThread) {
|
|
148
|
+
this._onDidChangeActiveEditingCommentThread.fire(commentThread);
|
|
149
|
+
}
|
|
150
|
+
async setActiveCommentAndThread(uniqueOwner, commentInfo) {
|
|
151
|
+
const commentController = this._commentControls.get(uniqueOwner);
|
|
152
|
+
if (!commentController) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (commentController !== this._lastActiveCommentController) {
|
|
156
|
+
await this._lastActiveCommentController?.setActiveCommentAndThread(undefined);
|
|
157
|
+
}
|
|
158
|
+
this._lastActiveCommentController = commentController;
|
|
159
|
+
return commentController.setActiveCommentAndThread(commentInfo);
|
|
160
|
+
}
|
|
161
|
+
setDocumentComments(resource, commentInfos) {
|
|
162
|
+
this._onDidSetResourceCommentInfos.fire({ resource, commentInfos });
|
|
163
|
+
}
|
|
164
|
+
setModelThreads(ownerId, owner, ownerLabel, commentThreads) {
|
|
165
|
+
this._commentsModel.setCommentThreads(ownerId, owner, ownerLabel, commentThreads);
|
|
166
|
+
this._onDidSetAllCommentThreads.fire({ ownerId, ownerLabel, commentThreads });
|
|
167
|
+
}
|
|
168
|
+
updateModelThreads(event) {
|
|
169
|
+
this._commentsModel.updateCommentThreads(event);
|
|
170
|
+
this._onDidUpdateCommentThreads.fire(event);
|
|
171
|
+
}
|
|
172
|
+
setWorkspaceComments(uniqueOwner, commentsByResource) {
|
|
173
|
+
if (commentsByResource.length) {
|
|
174
|
+
this._workspaceHasCommenting.set(true);
|
|
175
|
+
}
|
|
176
|
+
const control = this._commentControls.get(uniqueOwner);
|
|
177
|
+
if (control) {
|
|
178
|
+
this.setModelThreads(uniqueOwner, control.owner, control.label, commentsByResource);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
removeWorkspaceComments(uniqueOwner) {
|
|
182
|
+
const control = this._commentControls.get(uniqueOwner);
|
|
183
|
+
if (control) {
|
|
184
|
+
this.setModelThreads(uniqueOwner, control.owner, control.label, []);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
registerCommentController(uniqueOwner, commentControl) {
|
|
188
|
+
this._commentControls.set(uniqueOwner, commentControl);
|
|
189
|
+
this._onDidSetDataProvider.fire();
|
|
190
|
+
}
|
|
191
|
+
unregisterCommentController(uniqueOwner) {
|
|
192
|
+
if (uniqueOwner) {
|
|
193
|
+
this._commentControls.delete(uniqueOwner);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
this._commentControls.clear();
|
|
197
|
+
}
|
|
198
|
+
this._commentsModel.deleteCommentsByOwner(uniqueOwner);
|
|
199
|
+
this._onDidDeleteDataProvider.fire(uniqueOwner);
|
|
200
|
+
}
|
|
201
|
+
getCommentController(uniqueOwner) {
|
|
202
|
+
return this._commentControls.get(uniqueOwner);
|
|
203
|
+
}
|
|
204
|
+
async createCommentThreadTemplate(uniqueOwner, resource, range) {
|
|
205
|
+
const commentController = this._commentControls.get(uniqueOwner);
|
|
206
|
+
if (!commentController) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
return commentController.createCommentThreadTemplate(resource, range);
|
|
210
|
+
}
|
|
211
|
+
async updateCommentThreadTemplate(uniqueOwner, threadHandle, range) {
|
|
212
|
+
const commentController = this._commentControls.get(uniqueOwner);
|
|
213
|
+
if (!commentController) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
await commentController.updateCommentThreadTemplate(threadHandle, range);
|
|
217
|
+
}
|
|
218
|
+
disposeCommentThread(uniqueOwner, threadId) {
|
|
219
|
+
const controller = this.getCommentController(uniqueOwner);
|
|
220
|
+
controller?.deleteCommentThreadMain(threadId);
|
|
221
|
+
}
|
|
222
|
+
getCommentMenus(uniqueOwner) {
|
|
223
|
+
if (this._commentMenus.get(uniqueOwner)) {
|
|
224
|
+
return this._commentMenus.get(uniqueOwner);
|
|
225
|
+
}
|
|
226
|
+
const menu = this.instantiationService.createInstance(CommentMenus);
|
|
227
|
+
this._commentMenus.set(uniqueOwner, menu);
|
|
228
|
+
return menu;
|
|
229
|
+
}
|
|
230
|
+
updateComments(ownerId, event) {
|
|
231
|
+
const control = this._commentControls.get(ownerId);
|
|
232
|
+
if (control) {
|
|
233
|
+
const evt = Object.assign({}, event, { uniqueOwner: ownerId, ownerLabel: control.label, owner: control.owner });
|
|
234
|
+
this.updateModelThreads(evt);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
updateNotebookComments(ownerId, event) {
|
|
238
|
+
const evt = Object.assign({}, event, { uniqueOwner: ownerId });
|
|
239
|
+
this._onDidUpdateNotebookCommentThreads.fire(evt);
|
|
240
|
+
}
|
|
241
|
+
updateCommentingRanges(ownerId, resourceHints) {
|
|
242
|
+
if (resourceHints?.schemes && resourceHints.schemes.length > 0) {
|
|
243
|
+
for (const scheme of resourceHints.schemes) {
|
|
244
|
+
this._commentingRangeResourceHintSchemes.add(scheme);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
this._workspaceHasCommenting.set(true);
|
|
248
|
+
this._onDidUpdateCommentingRanges.fire({ uniqueOwner: ownerId });
|
|
249
|
+
}
|
|
250
|
+
async toggleReaction(uniqueOwner, resource, thread, comment, reaction) {
|
|
251
|
+
const commentController = this._commentControls.get(uniqueOwner);
|
|
252
|
+
if (commentController) {
|
|
253
|
+
return commentController.toggleReaction(resource, thread, comment, reaction, CancellationToken.None);
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
throw new Error('Not supported');
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
hasReactionHandler(uniqueOwner) {
|
|
260
|
+
const commentProvider = this._commentControls.get(uniqueOwner);
|
|
261
|
+
if (commentProvider) {
|
|
262
|
+
return !!commentProvider.features.reactionHandler;
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
async getDocumentComments(resource) {
|
|
267
|
+
const commentControlResult = [];
|
|
268
|
+
for (const control of ( this._commentControls.values())) {
|
|
269
|
+
commentControlResult.push(control.getDocumentComments(resource, CancellationToken.None)
|
|
270
|
+
.then(documentComments => {
|
|
271
|
+
for (const documentCommentThread of documentComments.threads) {
|
|
272
|
+
if (documentCommentThread.comments?.length === 0 && documentCommentThread.range) {
|
|
273
|
+
this.removeContinueOnComment({ range: documentCommentThread.range, uri: resource, uniqueOwner: documentComments.uniqueOwner });
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const pendingComments = this._continueOnComments.get(documentComments.uniqueOwner);
|
|
277
|
+
documentComments.pendingCommentThreads = pendingComments?.filter(pendingComment => ( pendingComment.uri.toString()) === ( resource.toString()));
|
|
278
|
+
return documentComments;
|
|
279
|
+
})
|
|
280
|
+
.catch(_ => {
|
|
281
|
+
return null;
|
|
282
|
+
}));
|
|
283
|
+
}
|
|
284
|
+
const commentInfos = await Promise.all(commentControlResult);
|
|
285
|
+
this._updateResourcesWithCommentingRanges(resource, commentInfos);
|
|
286
|
+
return commentInfos;
|
|
287
|
+
}
|
|
288
|
+
async getNotebookComments(resource) {
|
|
289
|
+
const commentControlResult = [];
|
|
290
|
+
this._commentControls.forEach(control => {
|
|
291
|
+
commentControlResult.push(control.getNotebookComments(resource, CancellationToken.None)
|
|
292
|
+
.catch(_ => {
|
|
293
|
+
return null;
|
|
294
|
+
}));
|
|
295
|
+
});
|
|
296
|
+
return Promise.all(commentControlResult);
|
|
297
|
+
}
|
|
298
|
+
registerContinueOnCommentProvider(provider) {
|
|
299
|
+
this._continueOnCommentProviders.add(provider);
|
|
300
|
+
return {
|
|
301
|
+
dispose: () => {
|
|
302
|
+
this._continueOnCommentProviders.delete(provider);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
_saveContinueOnComments(map) {
|
|
307
|
+
const commentsToSave = [];
|
|
308
|
+
for (const pendingComments of ( map.values())) {
|
|
309
|
+
commentsToSave.push(...pendingComments);
|
|
310
|
+
}
|
|
311
|
+
this.logService.debug(`Comments: URIs of continue on comments to add to storage ${( commentsToSave.map(thread => ( thread.uri.toString()))).join(', ')}.`);
|
|
312
|
+
this.storageService.store(CONTINUE_ON_COMMENTS, commentsToSave, 1 , 0 );
|
|
313
|
+
}
|
|
314
|
+
removeContinueOnComment(pendingComment) {
|
|
315
|
+
const pendingComments = this._continueOnComments.get(pendingComment.uniqueOwner);
|
|
316
|
+
if (pendingComments) {
|
|
317
|
+
const commentIndex = pendingComments.findIndex(comment => ( comment.uri.toString()) === ( pendingComment.uri.toString()) && Range.equalsRange(comment.range, pendingComment.range) && (pendingComment.isReply === undefined || comment.isReply === pendingComment.isReply));
|
|
318
|
+
if (commentIndex > -1) {
|
|
319
|
+
return pendingComments.splice(commentIndex, 1)[0];
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return undefined;
|
|
323
|
+
}
|
|
324
|
+
_addContinueOnComments(pendingComments, map) {
|
|
325
|
+
const changedOwners = ( new Set());
|
|
326
|
+
for (const pendingComment of pendingComments) {
|
|
327
|
+
if (!( map.has(pendingComment.uniqueOwner))) {
|
|
328
|
+
map.set(pendingComment.uniqueOwner, [pendingComment]);
|
|
329
|
+
changedOwners.add(pendingComment.uniqueOwner);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
const commentsForOwner = map.get(pendingComment.uniqueOwner);
|
|
333
|
+
if (commentsForOwner.every(comment => (( comment.uri.toString()) !== ( pendingComment.uri.toString())) || !Range.equalsRange(comment.range, pendingComment.range))) {
|
|
334
|
+
commentsForOwner.push(pendingComment);
|
|
335
|
+
changedOwners.add(pendingComment.uniqueOwner);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return changedOwners;
|
|
340
|
+
}
|
|
341
|
+
resourceHasCommentingRanges(resource) {
|
|
342
|
+
return ( this._commentingRangeResourceHintSchemes.has(resource.scheme)) || ( this._commentingRangeResources.has(( resource.toString())));
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
CommentService = ( __decorate([
|
|
346
|
+
( __param(0, IInstantiationService)),
|
|
347
|
+
( __param(1, IWorkbenchLayoutService)),
|
|
348
|
+
( __param(2, IConfigurationService)),
|
|
349
|
+
( __param(3, IContextKeyService)),
|
|
350
|
+
( __param(4, IStorageService)),
|
|
351
|
+
( __param(5, ILogService)),
|
|
352
|
+
( __param(6, IModelService))
|
|
353
|
+
], CommentService));
|
|
354
|
+
|
|
355
|
+
export { CommentService };
|
|
@@ -2,20 +2,22 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
4
4
|
import './commentsEditorContribution.js';
|
|
5
|
-
import
|
|
5
|
+
import './commentService.js';
|
|
6
|
+
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService.service';
|
|
6
7
|
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
7
8
|
import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
9
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
9
10
|
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
10
|
-
import {
|
|
11
|
+
import { NumberBadge } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
|
|
12
|
+
import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
|
|
11
13
|
import { COMMENTS_VIEW_ID } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsTreeViewer';
|
|
12
14
|
import { CommentThreadState } from 'vscode/vscode/vs/editor/common/languages';
|
|
13
15
|
import { registerAction2, MenuId, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
14
16
|
import { CONTEXT_KEY_HAS_COMMENTS, CONTEXT_KEY_SOME_COMMENTS_EXPANDED } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsView';
|
|
15
17
|
import { ViewAction } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
16
18
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
17
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
18
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
19
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
20
|
+
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
19
21
|
import { revealCommentThread } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsController';
|
|
20
22
|
|
|
21
23
|
registerAction2(class Collapse extends ViewAction {
|
|
@@ -6,14 +6,14 @@ import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/cod
|
|
|
6
6
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
7
7
|
import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
8
8
|
import { KeybindingsRegistry } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
9
|
-
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
|
|
9
|
+
import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService.service';
|
|
10
10
|
import { ctxCommentEditorFocused, SimpleCommentEditor } from 'vscode/vscode/vs/workbench/contrib/comments/browser/simpleCommentEditor';
|
|
11
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
11
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
12
12
|
import { MenuRegistry, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
13
13
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
14
14
|
import { ID, CommentController } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentsController';
|
|
15
15
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
16
|
-
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
16
|
+
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
17
17
|
import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
|
|
18
18
|
import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vscode/vscode/vs/platform/accessibility/common/accessibility';
|
|
19
19
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|