@codingame/monaco-vscode-extensions-service-override 2.0.3 → 2.1.0

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.
Files changed (25) hide show
  1. package/package.json +3 -3
  2. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +22 -127
  3. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -5
  4. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +3 -31
  5. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +2 -1
  6. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +32 -9
  7. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +7 -3
  8. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +3 -3
  9. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +1 -1
  10. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +1 -1
  11. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +6 -5
  12. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +3 -2
  13. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +11 -8
  14. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +2 -2
  15. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +1 -1
  16. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +27 -105
  17. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +37 -10
  18. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +14 -16
  19. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +5 -1
  20. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +4 -1
  21. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +5 -1
  22. package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +125 -0
  23. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +3 -2
  24. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +22 -114
  25. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +1 -120
@@ -1,7 +1,7 @@
1
1
  import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
2
  import { URI } from 'vscode/vscode/vs/base/common/uri';
3
3
  import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
4
- import { DisposableMap, DisposableStore, dispose, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { DisposableStore, dispose, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
5
  import { ISCMService, ISCMViewService } from 'vscode/vscode/vs/workbench/contrib/scm/common/scm';
6
6
  import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
7
7
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
@@ -10,25 +10,9 @@ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
10
10
  import { IQuickDiffService } from 'vscode/vscode/vs/workbench/contrib/scm/common/quickDiff';
11
11
  import { ResourceTree } from 'vscode/vscode/vs/base/common/resourceTree';
12
12
  import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
13
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
14
13
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
15
14
  import { basename } from 'vscode/vscode/vs/base/common/resources';
16
15
 
17
- function getSCMInputBoxActionButtonIcon(actionButton) {
18
- if (!actionButton.icon) {
19
- return undefined;
20
- }
21
- else if (URI.isUri(actionButton.icon)) {
22
- return URI.revive(actionButton.icon);
23
- }
24
- else if (ThemeIcon.isThemeIcon(actionButton.icon)) {
25
- return actionButton.icon;
26
- }
27
- else {
28
- const icon = actionButton.icon;
29
- return { light: URI.revive(icon.light), dark: URI.revive(icon.dark) };
30
- }
31
- }
32
16
  function getIconFromIconDto(iconDto) {
33
17
  if (iconDto === undefined) {
34
18
  return undefined;
@@ -56,13 +40,14 @@ class MainThreadSCMResourceGroup {
56
40
  return this._resourceTree;
57
41
  }
58
42
  get hideWhenEmpty() { return !!this.features.hideWhenEmpty; }
59
- constructor(sourceControlHandle, handle, provider, features, label, id, _uriIdentService) {
43
+ constructor(sourceControlHandle, handle, provider, features, label, id, multiDiffEditorEnableViewChanges, _uriIdentService) {
60
44
  this.sourceControlHandle = sourceControlHandle;
61
45
  this.handle = handle;
62
46
  this.provider = provider;
63
47
  this.features = features;
64
48
  this.label = label;
65
49
  this.id = id;
50
+ this.multiDiffEditorEnableViewChanges = multiDiffEditorEnableViewChanges;
66
51
  this._uriIdentService = _uriIdentService;
67
52
  this.resources = [];
68
53
  this._onDidChange = ( new Emitter());
@@ -92,7 +77,7 @@ class MainThreadSCMResourceGroup {
92
77
  }
93
78
  }
94
79
  class MainThreadSCMResource {
95
- constructor(proxy, sourceControlHandle, groupHandle, handle, sourceUri, resourceGroup, decorations, contextValue, command) {
80
+ constructor(proxy, sourceControlHandle, groupHandle, handle, sourceUri, resourceGroup, decorations, contextValue, command, multiDiffEditorOriginalUri, multiDiffEditorModifiedUri) {
96
81
  this.proxy = proxy;
97
82
  this.sourceControlHandle = sourceControlHandle;
98
83
  this.groupHandle = groupHandle;
@@ -102,6 +87,8 @@ class MainThreadSCMResource {
102
87
  this.decorations = decorations;
103
88
  this.contextValue = contextValue;
104
89
  this.command = command;
90
+ this.multiDiffEditorOriginalUri = multiDiffEditorOriginalUri;
91
+ this.multiDiffEditorModifiedUri = multiDiffEditorModifiedUri;
105
92
  }
106
93
  open(preserveFocus) {
107
94
  return this.proxy.$executeResourceCommand(this.sourceControlHandle, this.groupHandle, this.handle, preserveFocus);
@@ -116,11 +103,6 @@ class MainThreadSCMResource {
116
103
  }
117
104
  }
118
105
  class MainThreadSCMHistoryProvider {
119
- get actionButton() { return this._actionButton; }
120
- set actionButton(actionButton) {
121
- this._actionButton = actionButton;
122
- this._onDidChangeActionButton.fire();
123
- }
124
106
  get currentHistoryItemGroup() { return this._currentHistoryItemGroup; }
125
107
  set currentHistoryItemGroup(historyItemGroup) {
126
108
  this._currentHistoryItemGroup = historyItemGroup;
@@ -129,37 +111,9 @@ class MainThreadSCMHistoryProvider {
129
111
  constructor(proxy, handle) {
130
112
  this.proxy = proxy;
131
113
  this.handle = handle;
132
- this._onDidChangeActionButton = ( new Emitter());
133
- this.onDidChangeActionButton = this._onDidChangeActionButton.event;
134
114
  this._onDidChangeCurrentHistoryItemGroup = ( new Emitter());
135
115
  this.onDidChangeCurrentHistoryItemGroup = this._onDidChangeCurrentHistoryItemGroup.event;
136
116
  }
137
- async resolveHistoryItemGroupDetails(historyItemGroup) {
138
- const historyItemGroupBase = await this.resolveHistoryItemGroupBase(historyItemGroup.id);
139
- const ancestor = historyItemGroupBase ?
140
- await this.resolveHistoryItemGroupCommonAncestor(historyItemGroup.id, historyItemGroupBase.id) : undefined;
141
- let incoming;
142
- if (historyItemGroupBase) {
143
- incoming = {
144
- id: historyItemGroupBase.id,
145
- label: historyItemGroupBase.label,
146
- icon: Codicon.arrowCircleDown,
147
- ancestor: ancestor?.id,
148
- count: ancestor?.behind ?? 0,
149
- };
150
- }
151
- const outgoing = {
152
- id: historyItemGroup.id,
153
- label: historyItemGroup.label,
154
- icon: Codicon.arrowCircleUp,
155
- ancestor: ancestor?.id,
156
- count: ancestor?.ahead ?? 0,
157
- };
158
- return { incoming, outgoing };
159
- }
160
- async resolveHistoryItemGroupBase(historyItemGroupId) {
161
- return this.proxy.$resolveHistoryItemGroupBase(this.handle, historyItemGroupId, CancellationToken.None);
162
- }
163
117
  async resolveHistoryItemGroupCommonAncestor(historyItemGroupId1, historyItemGroupId2) {
164
118
  return this.proxy.$resolveHistoryItemGroupCommonAncestor(this.handle, historyItemGroupId1, historyItemGroupId2, CancellationToken.None);
165
119
  }
@@ -167,8 +121,12 @@ class MainThreadSCMHistoryProvider {
167
121
  const historyItems = await this.proxy.$provideHistoryItems(this.handle, historyItemGroupId, options, CancellationToken.None);
168
122
  return historyItems?.map(historyItem => ({ ...historyItem, icon: getIconFromIconDto(historyItem.icon) }));
169
123
  }
170
- async provideHistoryItemChanges(historyItemId) {
171
- const changes = await this.proxy.$provideHistoryItemChanges(this.handle, historyItemId, CancellationToken.None);
124
+ async provideHistoryItemSummary(historyItemId, historyItemParentId) {
125
+ const historyItem = await this.proxy.$provideHistoryItemSummary(this.handle, historyItemId, historyItemParentId, CancellationToken.None);
126
+ return historyItem ? { ...historyItem, icon: getIconFromIconDto(historyItem.icon) } : undefined;
127
+ }
128
+ async provideHistoryItemChanges(historyItemId, historyItemParentId) {
129
+ const changes = await this.proxy.$provideHistoryItemChanges(this.handle, historyItemId, historyItemParentId, CancellationToken.None);
172
130
  return changes?.map(change => ({
173
131
  uri: URI.revive(change.uri),
174
132
  originalUri: change.originalUri && URI.revive(change.originalUri),
@@ -260,8 +218,17 @@ class MainThreadSCMProvider {
260
218
  }
261
219
  }
262
220
  $registerGroups(_groups) {
263
- const groups = ( _groups.map(([handle, id, label, features]) => {
264
- const group = ( new MainThreadSCMResourceGroup(this.handle, handle, this, features, label, id, this._uriIdentService));
221
+ const groups = ( _groups.map(([handle, id, label, features, multiDiffEditorEnableViewChanges]) => {
222
+ const group = ( new MainThreadSCMResourceGroup(
223
+ this.handle,
224
+ handle,
225
+ this,
226
+ features,
227
+ label,
228
+ id,
229
+ multiDiffEditorEnableViewChanges,
230
+ this._uriIdentService
231
+ ));
265
232
  this._groupsByHandle[handle] = group;
266
233
  return group;
267
234
  }));
@@ -292,7 +259,7 @@ class MainThreadSCMProvider {
292
259
  groupSlices.reverse();
293
260
  for (const [start, deleteCount, rawResources] of groupSlices) {
294
261
  const resources = ( rawResources.map(rawResource => {
295
- const [handle, sourceUri, icons, tooltip, strikeThrough, faded, contextValue, command] = rawResource;
262
+ const [handle, sourceUri, icons, tooltip, strikeThrough, faded, contextValue, command, multiDiffEditorOriginalUri, multiDiffEditorModifiedUri] = rawResource;
296
263
  const [light, dark] = icons;
297
264
  const icon = ThemeIcon.isThemeIcon(light) ? light : URI.revive(light);
298
265
  const iconDark = (ThemeIcon.isThemeIcon(dark) ? dark : URI.revive(dark)) || icon;
@@ -312,7 +279,9 @@ class MainThreadSCMProvider {
312
279
  group,
313
280
  decorations,
314
281
  contextValue || undefined,
315
- command
282
+ command,
283
+ URI.revive(multiDiffEditorOriginalUri),
284
+ URI.revive(multiDiffEditorModifiedUri)
316
285
  ));
317
286
  }));
318
287
  group.splice(start, deleteCount, resources);
@@ -336,12 +305,6 @@ class MainThreadSCMProvider {
336
305
  const result = await this.proxy.$provideOriginalResource(this.handle, uri, CancellationToken.None);
337
306
  return result && URI.revive(result);
338
307
  }
339
- $onDidChangeHistoryProviderActionButton(actionButton) {
340
- if (!this._historyProvider) {
341
- return;
342
- }
343
- this._historyProvider.actionButton = actionButton ?? undefined;
344
- }
345
308
  $onDidChangeHistoryProviderCurrentHistoryItemGroup(currentHistoryItemGroup) {
346
309
  if (!this._historyProvider) {
347
310
  return;
@@ -358,17 +321,6 @@ class MainThreadSCMProvider {
358
321
  this._quickDiff?.dispose();
359
322
  }
360
323
  }
361
- class MainThreadSCMInputBoxValueProvider {
362
- constructor(proxy, handle, label, icon) {
363
- this.proxy = proxy;
364
- this.handle = handle;
365
- this.label = label;
366
- this.icon = icon;
367
- }
368
- provideValue(rootUri, context, token) {
369
- return this.proxy.$provideInputBoxValue(this.handle, rootUri, context, token);
370
- }
371
- }
372
324
  let MainThreadSCM = class MainThreadSCM {
373
325
  constructor(extHostContext, scmService, scmViewService, quickDiffService, _uriIdentService, workspaceContextService) {
374
326
  this.scmService = scmService;
@@ -378,7 +330,6 @@ let MainThreadSCM = class MainThreadSCM {
378
330
  this.workspaceContextService = workspaceContextService;
379
331
  this._repositories = ( new Map());
380
332
  this._repositoryDisposables = ( new Map());
381
- this._inputBoxValueProviders = ( new DisposableMap());
382
333
  this._disposables = ( new DisposableStore());
383
334
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostSCM));
384
335
  }
@@ -387,7 +338,6 @@ let MainThreadSCM = class MainThreadSCM {
387
338
  this._repositories.clear();
388
339
  dispose(( this._repositoryDisposables.values()));
389
340
  this._repositoryDisposables.clear();
390
- this._inputBoxValueProviders.dispose();
391
341
  this._disposables.dispose();
392
342
  }
393
343
  $registerSourceControl(handle, id, label, rootUri, inputBoxDocumentUri) {
@@ -431,19 +381,6 @@ let MainThreadSCM = class MainThreadSCM {
431
381
  repository.dispose();
432
382
  this._repositories.delete(handle);
433
383
  }
434
- $registerSourceControlInputBoxValueProvider(handle, sourceControlId, label, icon) {
435
- const provider = ( new MainThreadSCMInputBoxValueProvider(this._proxy, handle, label, getIconFromIconDto(icon)));
436
- const disposable = this.scmService.registerSCMInputValueProvider(sourceControlId, provider);
437
- this._inputBoxValueProviders.set(handle, disposable);
438
- }
439
- $unregisterSourceControlInputBoxValueProvider(handle) {
440
- const provider = this._inputBoxValueProviders.get(handle);
441
- if (!provider) {
442
- return;
443
- }
444
- provider.dispose();
445
- this._inputBoxValueProviders.deleteAndDispose(handle);
446
- }
447
384
  $registerGroups(sourceControlHandle, groups, splices) {
448
385
  const repository = this._repositories.get(sourceControlHandle);
449
386
  if (!repository) {
@@ -513,13 +450,6 @@ let MainThreadSCM = class MainThreadSCM {
513
450
  }
514
451
  repository.input.visible = visible;
515
452
  }
516
- $setInputBoxActionButton(sourceControlHandle, actionButton) {
517
- const repository = this._repositories.get(sourceControlHandle);
518
- if (!repository) {
519
- return;
520
- }
521
- repository.input.actionButton = actionButton ? { ...actionButton, icon: getSCMInputBoxActionButtonIcon(actionButton) } : undefined;
522
- }
523
453
  $showValidationMessage(sourceControlHandle, message, type) {
524
454
  const repository = this._repositories.get(sourceControlHandle);
525
455
  if (!repository) {
@@ -542,14 +472,6 @@ let MainThreadSCM = class MainThreadSCM {
542
472
  repository.input.validateInput = async () => undefined;
543
473
  }
544
474
  }
545
- $onDidChangeHistoryProviderActionButton(sourceControlHandle, actionButton) {
546
- const repository = this._repositories.get(sourceControlHandle);
547
- if (!repository) {
548
- return;
549
- }
550
- const provider = repository.provider;
551
- provider.$onDidChangeHistoryProviderActionButton(actionButton);
552
- }
553
475
  $onDidChangeHistoryProviderCurrentHistoryItemGroup(sourceControlHandle, historyItemGroup) {
554
476
  const repository = this._repositories.get(sourceControlHandle);
555
477
  if (!repository) {
@@ -1,19 +1,19 @@
1
1
  import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
2
  import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
3
3
  import { Emitter } from 'vscode/vscode/vs/base/common/event';
4
- import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
5
5
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
6
6
  import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
7
7
  import { ISpeechService } from 'vscode/vscode/vs/workbench/contrib/speech/common/speechService';
8
8
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
9
9
 
10
- let MainThreadSpeech = class MainThreadSpeech extends Disposable {
10
+ let MainThreadSpeech = class MainThreadSpeech {
11
11
  constructor(extHostContext, speechService, logService) {
12
- super();
13
12
  this.speechService = speechService;
14
13
  this.logService = logService;
15
14
  this.providerRegistrations = ( new Map());
16
- this.providerSessions = ( new Map());
15
+ this.speechToTextSessions = ( new Map());
16
+ this.keywordRecognitionSessions = ( new Map());
17
17
  this.proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostSpeech));
18
18
  }
19
19
  $registerProvider(handle, identifier, metadata) {
@@ -27,12 +27,29 @@ let MainThreadSpeech = class MainThreadSpeech extends Disposable {
27
27
  this.proxy.$createSpeechToTextSession(handle, session);
28
28
  disposables.add(token.onCancellationRequested(() => this.proxy.$cancelSpeechToTextSession(session)));
29
29
  const onDidChange = disposables.add(( new Emitter()));
30
- this.providerSessions.set(session, { onDidChange });
30
+ this.speechToTextSessions.set(session, { onDidChange });
31
31
  return {
32
32
  onDidChange: onDidChange.event,
33
33
  dispose: () => {
34
34
  cts.dispose(true);
35
- this.providerSessions.delete(session);
35
+ this.speechToTextSessions.delete(session);
36
+ disposables.dispose();
37
+ }
38
+ };
39
+ },
40
+ createKeywordRecognitionSession: token => {
41
+ const disposables = ( new DisposableStore());
42
+ const cts = ( new CancellationTokenSource(token));
43
+ const session = Math.random();
44
+ this.proxy.$createKeywordRecognitionSession(handle, session);
45
+ disposables.add(token.onCancellationRequested(() => this.proxy.$cancelKeywordRecognitionSession(session)));
46
+ const onDidChange = disposables.add(( new Emitter()));
47
+ this.keywordRecognitionSessions.set(session, { onDidChange });
48
+ return {
49
+ onDidChange: onDidChange.event,
50
+ dispose: () => {
51
+ cts.dispose(true);
52
+ this.keywordRecognitionSessions.delete(session);
36
53
  disposables.dispose();
37
54
  }
38
55
  };
@@ -52,10 +69,20 @@ let MainThreadSpeech = class MainThreadSpeech extends Disposable {
52
69
  }
53
70
  }
54
71
  $emitSpeechToTextEvent(session, event) {
55
- const providerSession = this.providerSessions.get(session);
56
- if (providerSession) {
57
- providerSession.onDidChange.fire(event);
58
- }
72
+ const providerSession = this.speechToTextSessions.get(session);
73
+ providerSession?.onDidChange.fire(event);
74
+ }
75
+ $emitKeywordRecognitionEvent(session, event) {
76
+ const providerSession = this.keywordRecognitionSessions.get(session);
77
+ providerSession?.onDidChange.fire(event);
78
+ }
79
+ dispose() {
80
+ this.providerRegistrations.forEach(disposable => disposable.dispose());
81
+ this.providerRegistrations.clear();
82
+ this.speechToTextSessions.forEach(session => session.onDidChange.dispose());
83
+ this.speechToTextSessions.clear();
84
+ this.keywordRecognitionSessions.forEach(session => session.onDidChange.dispose());
85
+ this.keywordRecognitionSessions.clear();
59
86
  }
60
87
  };
61
88
  MainThreadSpeech = __decorate([
@@ -4,6 +4,7 @@ import { Disposable, MutableDisposable, DisposableStore, toDisposable } from 'vs
4
4
  import { WellDefinedPrefixTree } from 'vscode/vscode/vs/base/common/prefixTree';
5
5
  import { URI } from 'vscode/vscode/vs/base/common/uri';
6
6
  import { Range } from 'vscode/vscode/vs/editor/common/core/range';
7
+ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
7
8
  import { MutableObservableValue } from 'vscode/vscode/vs/workbench/contrib/testing/common/observableValue';
8
9
  import { TestCoverage } from 'vscode/vscode/vs/workbench/contrib/testing/common/testCoverage';
9
10
  import { TestId } from 'vscode/vscode/vs/workbench/contrib/testing/common/testId';
@@ -16,8 +17,9 @@ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCu
16
17
  import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
17
18
 
18
19
  let MainThreadTesting = class MainThreadTesting extends Disposable {
19
- constructor(extHostContext, testService, testProfiles, resultService) {
20
+ constructor(extHostContext, uriIdentityService, testService, testProfiles, resultService) {
20
21
  super();
22
+ this.uriIdentityService = uriIdentityService;
21
23
  this.testService = testService;
22
24
  this.testProfiles = testProfiles;
23
25
  this.resultService = resultService;
@@ -28,16 +30,11 @@ let MainThreadTesting = class MainThreadTesting extends Disposable {
28
30
  this.proxy.$cancelExtensionTestRun(runId);
29
31
  }));
30
32
  this._register(Event.debounce(testProfiles.onDidChange, (_last, e) => e)(() => {
31
- const defaults = ( new Set([
32
- ...testProfiles.getGroupDefaultProfiles(2 ),
33
- ...testProfiles.getGroupDefaultProfiles(4 ),
34
- ...testProfiles.getGroupDefaultProfiles(8 ),
35
- ]));
36
33
  const obj = {};
37
34
  for (const { controller, profiles } of this.testProfiles.all()) {
38
- obj[controller.id] = ( profiles.filter(p => ( defaults.has(p))).map(p => p.profileId));
35
+ obj[controller.id] = ( profiles.filter(p => p.isDefault).map(p => p.profileId));
39
36
  }
40
- this.proxy.$setActiveRunProfiles(obj);
37
+ this.proxy.$setDefaultRunProfiles(obj);
41
38
  }));
42
39
  this._register(resultService.onResultsChanged(evt => {
43
40
  const results = 'completed' in evt ? evt.completed : ('inserted' in evt ? evt.inserted : undefined);
@@ -74,7 +71,7 @@ let MainThreadTesting = class MainThreadTesting extends Disposable {
74
71
  this.testProfiles.removeProfile(controllerId, profileId);
75
72
  }
76
73
  $addTestsToRun(controllerId, runId, tests) {
77
- this.withLiveRun(runId, r => r.addTestChainToRun(controllerId, ( tests.map(ITestItem.deserialize))));
74
+ this.withLiveRun(runId, r => r.addTestChainToRun(controllerId, ( tests.map(t => ITestItem.deserialize(this.uriIdentityService, t)))));
78
75
  }
79
76
  $signalCoverageAvailable(runId, taskId, available) {
80
77
  this.withLiveRun(runId, run => {
@@ -84,10 +81,10 @@ let MainThreadTesting = class MainThreadTesting extends Disposable {
84
81
  }
85
82
  const fn = available ? ((token) => TestCoverage.load(taskId, {
86
83
  provideFileCoverage: async (token) => await this.proxy.$provideFileCoverage(runId, taskId, token)
87
- .then(c => ( c.map(IFileCoverage.deserialize))),
84
+ .then(c => ( c.map(u => IFileCoverage.deserialize(this.uriIdentityService, u)))),
88
85
  resolveFileCoverage: (i, token) => this.proxy.$resolveFileCoverage(runId, taskId, i, token)
89
86
  .then(d => ( d.map(CoverageDetails.deserialize))),
90
- }, token)) : undefined;
87
+ }, this.uriIdentityService, token)) : undefined;
91
88
  task.coverage.set(fn, undefined);
92
89
  });
93
90
  }
@@ -117,7 +114,7 @@ let MainThreadTesting = class MainThreadTesting extends Disposable {
117
114
  const r = this.resultService.getResult(runId);
118
115
  if (r && r instanceof LiveTestResult) {
119
116
  for (const message of messages) {
120
- r.appendMessage(testId, taskId, ITestMessage.deserialize(message));
117
+ r.appendMessage(testId, taskId, ITestMessage.deserialize(this.uriIdentityService, message));
121
118
  }
122
119
  }
123
120
  }
@@ -169,7 +166,7 @@ let MainThreadTesting = class MainThreadTesting extends Disposable {
169
166
  this.diffListener.clear();
170
167
  }
171
168
  $publishDiff(controllerId, diff) {
172
- this.testService.publishDiff(controllerId, ( diff.map(TestsDiffOp.deserialize)));
169
+ this.testService.publishDiff(controllerId, ( diff.map(d => TestsDiffOp.deserialize(this.uriIdentityService, d))));
173
170
  }
174
171
  async $runTests(req, token) {
175
172
  const result = await this.testService.runResolvedTests(req, token);
@@ -189,9 +186,10 @@ let MainThreadTesting = class MainThreadTesting extends Disposable {
189
186
  };
190
187
  MainThreadTesting = __decorate([
191
188
  extHostNamedCustomer(MainContext.MainThreadTesting),
192
- ( __param(1, ITestService)),
193
- ( __param(2, ITestProfileService)),
194
- ( __param(3, ITestResultService))
189
+ ( __param(1, IUriIdentityService)),
190
+ ( __param(2, ITestService)),
191
+ ( __param(3, ITestProfileService)),
192
+ ( __param(4, ITestResultService))
195
193
  ], MainThreadTesting);
196
194
 
197
195
  export { MainThreadTesting };
@@ -1,7 +1,7 @@
1
1
  import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
2
  import { Disposable, DisposableMap, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
3
3
  import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
4
- import { IViewsService, Extensions, NoTreeViewError, ResolvableTreeItem } from 'vscode/vscode/vs/workbench/common/views';
4
+ import { Extensions, NoTreeViewError, ResolvableTreeItem } from 'vscode/vscode/vs/workbench/common/views';
5
5
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
6
6
  import { distinct } from 'vscode/vscode/vs/base/common/arrays';
7
7
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
@@ -12,6 +12,7 @@ import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
12
12
  import { VSDataTransfer, createStringDataTransferItem } from 'vscode/vscode/vs/base/common/dataTransfer';
13
13
  import { DataTransferFileCache } from '../common/shared/dataTransferCache.js';
14
14
  import { DataTransfer } from 'vscode/vscode/vs/workbench/api/common/extHostTypeConverters';
15
+ import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
15
16
 
16
17
  let MainThreadTreeViews = class MainThreadTreeViews extends Disposable {
17
18
  constructor(extHostContext, viewsService, notificationService, extensionService, logService) {
@@ -235,6 +236,9 @@ class TreeViewDataProvider {
235
236
  this.hasResolve = this._proxy.$hasResolve(this.treeViewId);
236
237
  }
237
238
  getChildren(treeItem) {
239
+ if (!treeItem) {
240
+ this.itemsMap.clear();
241
+ }
238
242
  return this._proxy.$getChildren(this.treeViewId, treeItem ? treeItem.handle : undefined)
239
243
  .then(children => this.postGetChildren(children), err => {
240
244
  if (!NoTreeViewError.is(err)) {
@@ -16,6 +16,7 @@ import { CommentThreadWidget } from 'vscode/vscode/vs/workbench/contrib/comments
16
16
  import { commentThreadStateColorVar, commentThreadStateBackgroundColorVar, getCommentThreadStateBorderColor } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentColors';
17
17
  import { peekViewBorder } from 'vscode/vscode/vs/editor/contrib/peekView/browser/peekView';
18
18
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
19
+ import { StableEditorScrollState } from 'vscode/vscode/vs/editor/browser/stableEditorScroll';
19
20
 
20
21
  function getCommentThreadWidgetStateColor(thread, theme) {
21
22
  return getCommentThreadStateBorderColor(thread, theme) ?? theme.getColor(peekViewBorder);
@@ -290,7 +291,7 @@ let ReviewZoneWidget = class ReviewZoneWidget extends ZoneWidget {
290
291
  }));
291
292
  if (this._initialCollapsibleState === undefined) {
292
293
  const onDidChangeInitialCollapsibleState = this._commentThread.onDidChangeInitialCollapsibleState(state => {
293
- this._initialCollapsibleState = this._commentThread.range ? state : CommentThreadCollapsibleState.Expanded;
294
+ this._initialCollapsibleState = state;
294
295
  this._commentThread.collapsibleState = this._initialCollapsibleState;
295
296
  onDidChangeInitialCollapsibleState.dispose();
296
297
  });
@@ -331,7 +332,9 @@ let ReviewZoneWidget = class ReviewZoneWidget extends ZoneWidget {
331
332
  if (!this._commentThread.comments || !this._commentThread.comments.length) {
332
333
  this._commentThreadWidget.focusCommentEditor();
333
334
  }
335
+ const capture = StableEditorScrollState.capture(this.editor);
334
336
  this._relayout(computedLinesNumber);
337
+ capture.restore(this.editor);
335
338
  }
336
339
  }
337
340
  _applyTheme(theme) {
@@ -20,7 +20,7 @@ import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/bro
20
20
  import { ReviewZoneWidget, parseMouseDownInfoFromEvent, isMouseUpEventDragFromMouseDown } from './commentThreadZoneWidget.js';
21
21
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
22
22
  import { EmbeddedCodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/embeddedCodeEditorWidget';
23
- import { IViewsService } from 'vscode/vscode/vs/workbench/common/views';
23
+ import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
24
24
  import { COMMENTS_VIEW_ID } from './commentsTreeViewer.js';
25
25
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
26
26
  import { COMMENTS_SECTION } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentsConfiguration';
@@ -508,6 +508,7 @@ let CommentController = class CommentController {
508
508
  return;
509
509
  }
510
510
  this._editorDisposables.push(this.editor.onMouseMove(e => this.onEditorMouseMove(e)));
511
+ this._editorDisposables.push(this.editor.onMouseLeave(() => this.onEditorMouseLeave()));
511
512
  this._editorDisposables.push(this.editor.onDidChangeCursorPosition(e => this.onEditorChangeCursorPosition(e.position)));
512
513
  this._editorDisposables.push(this.editor.onDidFocusEditorWidget(() => this.onEditorChangeCursorPosition(this.editor?.getPosition() ?? null)));
513
514
  this._editorDisposables.push(this.editor.onDidChangeCursorSelection(e => this.onEditorChangeCursorSelection(e)));
@@ -517,6 +518,9 @@ let CommentController = class CommentController {
517
518
  dispose(this._editorDisposables);
518
519
  this._editorDisposables = [];
519
520
  }
521
+ onEditorMouseLeave() {
522
+ this._commentingRangeDecorator.updateHover();
523
+ }
520
524
  onEditorMouseMove(e) {
521
525
  const position = e.target.position?.lineNumber;
522
526
  if (e.event.leftButton.valueOf() && position && this.mouseDownInfo) {
@@ -0,0 +1,125 @@
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 };