@codingame/monaco-vscode-api 3.0.0 → 3.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.
- package/api.js +1 -1
- package/assets/continue-tb.png +0 -0
- package/assets/pause-tb.png +0 -0
- package/assets/restart-tb.png +0 -0
- package/assets/run-with-debugging-tb.png +0 -0
- package/assets/stepinto-tb.png +0 -0
- package/assets/stepout-tb.png +0 -0
- package/assets/stepover-tb.png +0 -0
- package/assets/stop-tb.png +0 -0
- package/contributions.js +2 -0
- package/missing-services.js +17 -2
- package/package.json +8 -8
- package/service-override/tools/editorAssets.js +3 -0
- package/services.d.ts +6 -3
- package/services.js +17 -3
- package/vscode/src/vs/base/common/lifecycle.js +158 -1
- package/vscode/src/vs/base/common/observableInternal/autorun.js +3 -1
- package/vscode/src/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -0
- package/vscode/src/vs/platform/tunnel/common/tunnel.js +267 -1
- package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostNotebookDocument.js +1 -11
- package/vscode/src/vs/workbench/browser/actions/developerActions.js +703 -0
- package/vscode/src/vs/workbench/browser/actions/media/actions.css.js +4 -0
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +300 -0
- package/vscode/src/vs/workbench/browser/actions/textInputActions.js +83 -0
- package/vscode/src/vs/workbench/browser/dnd.js +2 -1
- package/vscode/src/vs/workbench/browser/parts/globalCompositeBar.js +323 -8
- package/vscode/src/vs/workbench/common/contributions.d.ts +44 -1
- package/vscode/src/vs/workbench/common/contributions.js +8 -1
- package/vscode/src/vs/workbench/common/views.js +1 -3
- package/vscode/src/vs/workbench/contrib/debug/browser/media/all.png.js +11 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.editorPane.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/logs/common/defaultLogLevels.js +140 -0
- package/vscode/src/vs/workbench/services/workspaces/common/workspaceIdentityService.js +102 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -430
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -510
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
package/api.js
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/contributions.js
CHANGED
|
@@ -26,6 +26,8 @@ import './vscode/src/vs/workbench/contrib/list/browser/list.contribution.js';
|
|
|
26
26
|
import './vscode/src/vs/workbench/contrib/codeEditor/browser/editorFeatures.js';
|
|
27
27
|
import './vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js';
|
|
28
28
|
import './vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js';
|
|
29
|
+
import './vscode/src/vs/workbench/browser/actions/textInputActions.js';
|
|
30
|
+
import './vscode/src/vs/workbench/browser/actions/developerActions.js';
|
|
29
31
|
let ExtensionPoints = class ExtensionPoints {
|
|
30
32
|
constructor(instantiationService) {
|
|
31
33
|
this.instantiationService = instantiationService;
|
package/missing-services.js
CHANGED
|
@@ -192,6 +192,8 @@ import { IWorkspaceTagsService } from './vscode/src/vs/workbench/contrib/tags/co
|
|
|
192
192
|
import { NoOpWorkspaceTagsService } from './vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js';
|
|
193
193
|
import { IExtensionFeaturesManagementService } from './vscode/src/vs/workbench/services/extensionManagement/common/extensionFeatures.js';
|
|
194
194
|
import { IEditorPaneService } from './vscode/src/vs/workbench/services/editor/common/editorPaneService.js';
|
|
195
|
+
import { IWorkspaceIdentityService } from './vscode/src/vs/workbench/services/workspaces/common/workspaceIdentityService.js';
|
|
196
|
+
import { IDefaultLogLevelsService } from './vscode/src/vs/workbench/contrib/logs/common/defaultLogLevels.js';
|
|
195
197
|
import { getBuiltInExtensionTranslationsUris } from './l10n.js';
|
|
196
198
|
import { unsupported } from './tools.js';
|
|
197
199
|
import { IFileDialogService } from './vscode/src/vs/platform/dialogs/common/dialogs.js';
|
|
@@ -528,8 +530,8 @@ registerSingleton(IPathService, BrowserPathService, 1 );
|
|
|
528
530
|
registerSingleton(IProductService, class ProductService {
|
|
529
531
|
constructor() {
|
|
530
532
|
this._serviceBrand = undefined;
|
|
531
|
-
this.version = "1.87.
|
|
532
|
-
this.commit = "1.87.
|
|
533
|
+
this.version = "1.87.1";
|
|
534
|
+
this.commit = "1.87.1";
|
|
533
535
|
this.quality = 'oss';
|
|
534
536
|
this.nameShort = 'Code - OSS Dev';
|
|
535
537
|
this.nameLong = 'Code - OSS Dev';
|
|
@@ -3010,3 +3012,16 @@ registerSingleton(IEditorPaneService, class EditorPaneService {
|
|
|
3010
3012
|
this.didInstantiateEditorPane = () => false;
|
|
3011
3013
|
}
|
|
3012
3014
|
}, 1 );
|
|
3015
|
+
registerSingleton(IWorkspaceIdentityService, class WorkspaceIdentityService {
|
|
3016
|
+
constructor() {
|
|
3017
|
+
this.matches = unsupported;
|
|
3018
|
+
this.getWorkspaceStateFolders = unsupported;
|
|
3019
|
+
}
|
|
3020
|
+
}, 1 );
|
|
3021
|
+
registerSingleton(IDefaultLogLevelsService, class DefaultLogLevelsService {
|
|
3022
|
+
constructor() {
|
|
3023
|
+
this.getDefaultLogLevels = unsupported;
|
|
3024
|
+
this.setDefaultLogLevel = unsupported;
|
|
3025
|
+
this.migrateLogLevels = unsupported;
|
|
3026
|
+
}
|
|
3027
|
+
}, 1 );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "VSCode public API plugged on the monaco editor",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": {
|
|
@@ -96,12 +96,12 @@
|
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"vscode-marked": "npm:marked@=3.0.2",
|
|
98
98
|
"vscode-semver": "npm:semver@=5.5.0",
|
|
99
|
-
"@codingame/monaco-vscode-
|
|
100
|
-
"@codingame/monaco-vscode-
|
|
101
|
-
"@codingame/monaco-vscode-
|
|
102
|
-
"@codingame/monaco-vscode-environment-service-override": "3.
|
|
103
|
-
"@codingame/monaco-vscode-layout-service-override": "3.
|
|
104
|
-
"@codingame/monaco-vscode-host-service-override": "3.
|
|
105
|
-
"@codingame/monaco-vscode-base-service-override": "3.
|
|
99
|
+
"@codingame/monaco-vscode-extensions-service-override": "3.1.0",
|
|
100
|
+
"@codingame/monaco-vscode-files-service-override": "3.1.0",
|
|
101
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "3.1.0",
|
|
102
|
+
"@codingame/monaco-vscode-environment-service-override": "3.1.0",
|
|
103
|
+
"@codingame/monaco-vscode-layout-service-override": "3.1.0",
|
|
104
|
+
"@codingame/monaco-vscode-host-service-override": "3.1.0",
|
|
105
|
+
"@codingame/monaco-vscode-base-service-override": "3.1.0"
|
|
106
106
|
}
|
|
107
107
|
}
|
package/services.d.ts
CHANGED
|
@@ -16,14 +16,17 @@ export { IConfigurationChangeEvent, IConfigurationService } from './vscode/src/v
|
|
|
16
16
|
export { INeverShowAgainOptions, INotification, INotificationActions, INotificationHandle, INotificationProgress, INotificationProgressProperties, INotificationProperties, INotificationService, IPromptChoice, IPromptChoiceWithMenu, IPromptOptions, IStatusMessageOptions, NeverShowAgainScope, NoOpNotification, NoOpProgress, NotificationMessage, NotificationPriority, NotificationsFilter } from './vscode/src/vs/platform/notification/common/notification.js';
|
|
17
17
|
export { IStorageService, StorageScope, StorageTarget } from './vscode/src/vs/platform/storage/common/storage.js';
|
|
18
18
|
export { ITextModelContentProvider, ITextModelService } from './vscode/src/vs/editor/common/services/resolverService.js';
|
|
19
|
+
import { WorkbenchContributionInstantiation } from './vscode/src/vs/workbench/common/contributions.js';
|
|
20
|
+
export { ILazyWorkbenchContributionInstantiation, IOnEditorWorkbenchContributionInstantiation, WorkbenchPhase } from './vscode/src/vs/workbench/common/contributions.js';
|
|
19
21
|
export { ITextFileService } from './vscode/src/vs/workbench/services/textfile/common/textfiles.js';
|
|
20
22
|
export { IAction } from './vscode/src/vs/base/common/actions.js';
|
|
21
23
|
export { IAccessibilitySignalService } from './vscode/src/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js';
|
|
24
|
+
export { IWorkbenchLayoutService } from './vscode/src/vs/workbench/services/layout/browser/layoutService.js';
|
|
25
|
+
export { IClipboardService } from './vscode/src/vs/platform/clipboard/common/clipboardService.js';
|
|
22
26
|
export { ILanguageFeaturesService } from './vscode/src/vs/editor/common/services/languageFeatures.js';
|
|
23
27
|
export { ILogService, ILoggerService, LogLevel } from './vscode/src/vs/platform/log/common/log.js';
|
|
24
28
|
export { IKeybindingService } from './vscode/src/vs/platform/keybinding/common/keybinding.js';
|
|
25
29
|
export { IWorkspaceContextService } from './vscode/src/vs/platform/workspace/common/workspace.js';
|
|
26
|
-
export { IClipboardService } from './vscode/src/vs/platform/clipboard/common/clipboardService.js';
|
|
27
30
|
export { IEditorWorkerService } from './vscode/src/vs/editor/common/services/editorWorker.js';
|
|
28
31
|
export { IOpenerService } from './vscode/src/vs/platform/opener/common/opener.js';
|
|
29
32
|
export { IModelService } from './vscode/src/vs/editor/common/services/model.js';
|
|
@@ -71,7 +74,6 @@ export { IRemoteSocketFactoryService } from './vscode/src/vs/platform/remote/com
|
|
|
71
74
|
export { ITerminalInstanceService, ITerminalService } from './vscode/src/vs/workbench/contrib/terminal/browser/terminal.js';
|
|
72
75
|
export { IFilesConfigurationService } from './vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js';
|
|
73
76
|
export { ILabelService } from './vscode/src/vs/platform/label/common/label.js';
|
|
74
|
-
export { IWorkbenchLayoutService } from './vscode/src/vs/workbench/services/layout/browser/layoutService.js';
|
|
75
77
|
export { IActivityService, IBadge } from './vscode/src/vs/workbench/services/activity/common/activity.js';
|
|
76
78
|
export { IHoverService } from './vscode/src/vs/platform/hover/browser/hover.js';
|
|
77
79
|
export { IExplorerService } from './vscode/src/vs/workbench/contrib/files/browser/files.js';
|
|
@@ -87,5 +89,6 @@ declare function createInstanceSync<Ctor extends new (...args: any[]) => any, R
|
|
|
87
89
|
* Equivalent to `StandaloneServices.withServices` except the callback is called when the services are ready, not just initialized
|
|
88
90
|
*/
|
|
89
91
|
declare function withReadyServices(callback: (serviceAccessor: ServicesAccessor) => IDisposable): IDisposable;
|
|
92
|
+
declare const registerWorkbenchContribution: (id: string, contribution: (accessor: ServicesAccessor) => void, instantiation: WorkbenchContributionInstantiation) => void;
|
|
90
93
|
|
|
91
|
-
export { IEditorOverrideServices, IWorkbenchConstructionOptions, createInstance, createInstanceSync, getService, initialize, withReadyServices };
|
|
94
|
+
export { IEditorOverrideServices, IWorkbenchConstructionOptions, ServicesAccessor, WorkbenchContributionInstantiation, createInstance, createInstanceSync, getService, initialize, registerWorkbenchContribution, withReadyServices };
|
package/services.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __decorate, __param } from './external/tslib/tslib.es6.js';
|
|
1
2
|
import './missing-services.js';
|
|
2
3
|
import './contributions.js';
|
|
3
4
|
import './vscode/src/vs/editor/browser/coreCommands.js';
|
|
@@ -68,6 +69,8 @@ import { mixin } from './vscode/src/vs/base/common/objects.js';
|
|
|
68
69
|
import { IInstantiationService } from './vscode/src/vs/platform/instantiation/common/instantiation.js';
|
|
69
70
|
import { IProductService } from './vscode/src/vs/platform/product/common/productService.js';
|
|
70
71
|
import { DisposableStore } from './vscode/src/vs/base/common/lifecycle.js';
|
|
72
|
+
import { registerWorkbenchContribution2 } from './vscode/src/vs/workbench/common/contributions.js';
|
|
73
|
+
export { WorkbenchPhase } from './vscode/src/vs/workbench/common/contributions.js';
|
|
71
74
|
import { initialize as initialize$1 } from './workbench.js';
|
|
72
75
|
import { checkServicesNotInitialized, startup, waitServicesReady, checkServicesReady, serviceInitializedBarrier, serviceInitializedEmitter } from './lifecycle.js';
|
|
73
76
|
import getServiceOverride$2$1 from '@codingame/monaco-vscode-quickaccess-service-override';
|
|
@@ -147,9 +150,9 @@ async function initialize(overrides, container = document.body, configuration =
|
|
|
147
150
|
initialize$1(container, configuration);
|
|
148
151
|
const instantiationService = StandaloneServices.initialize({
|
|
149
152
|
[( IProductService.toString())]: mixin({
|
|
150
|
-
version: "1.87.
|
|
153
|
+
version: "1.87.1",
|
|
151
154
|
quality: 'oss',
|
|
152
|
-
commit: "1.87.
|
|
155
|
+
commit: "1.87.1",
|
|
153
156
|
nameShort: 'Code - OSS Dev',
|
|
154
157
|
nameLong: 'Code - OSS Dev',
|
|
155
158
|
applicationName: 'code-oss',
|
|
@@ -195,4 +198,15 @@ function withReadyServices(callback) {
|
|
|
195
198
|
}));
|
|
196
199
|
return disposable;
|
|
197
200
|
}
|
|
198
|
-
|
|
201
|
+
const registerWorkbenchContribution = (id, contribution, instantiation) => {
|
|
202
|
+
let Contribution = class Contribution {
|
|
203
|
+
constructor(instantiationService) {
|
|
204
|
+
instantiationService.invokeFunction(contribution);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
Contribution = __decorate([
|
|
208
|
+
( __param(0, IInstantiationService))
|
|
209
|
+
], Contribution);
|
|
210
|
+
registerWorkbenchContribution2(id, Contribution, instantiation);
|
|
211
|
+
};
|
|
212
|
+
export { IInstantiationService, IProductService, StandaloneServices, createInstance, createInstanceSync, getService, initialize, registerWorkbenchContribution, withReadyServices };
|
|
@@ -1,9 +1,147 @@
|
|
|
1
|
+
import { compareBy, numberComparator } from './arrays.js';
|
|
2
|
+
import { groupBy } from './collections.js';
|
|
3
|
+
import { SetMap } from './map.js';
|
|
1
4
|
import { createSingleCallFunction } from './functional.js';
|
|
2
5
|
import { Iterable } from './iterator.js';
|
|
6
|
+
let disposableTracker = null;
|
|
7
|
+
class DisposableTracker {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.livingDisposables = ( new Map());
|
|
10
|
+
}
|
|
11
|
+
static { this.idx = 0; }
|
|
12
|
+
getDisposableData(d) {
|
|
13
|
+
let val = this.livingDisposables.get(d);
|
|
14
|
+
if (!val) {
|
|
15
|
+
val = { parent: null, source: null, isSingleton: false, value: d, idx: DisposableTracker.idx++ };
|
|
16
|
+
this.livingDisposables.set(d, val);
|
|
17
|
+
}
|
|
18
|
+
return val;
|
|
19
|
+
}
|
|
20
|
+
trackDisposable(d) {
|
|
21
|
+
const data = this.getDisposableData(d);
|
|
22
|
+
if (!data.source) {
|
|
23
|
+
data.source =
|
|
24
|
+
( new Error()).stack;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
setParent(child, parent) {
|
|
28
|
+
const data = this.getDisposableData(child);
|
|
29
|
+
data.parent = parent;
|
|
30
|
+
}
|
|
31
|
+
markAsDisposed(x) {
|
|
32
|
+
this.livingDisposables.delete(x);
|
|
33
|
+
}
|
|
34
|
+
markAsSingleton(disposable) {
|
|
35
|
+
this.getDisposableData(disposable).isSingleton = true;
|
|
36
|
+
}
|
|
37
|
+
getRootParent(data, cache) {
|
|
38
|
+
const cacheValue = cache.get(data);
|
|
39
|
+
if (cacheValue) {
|
|
40
|
+
return cacheValue;
|
|
41
|
+
}
|
|
42
|
+
const result = data.parent ? this.getRootParent(this.getDisposableData(data.parent), cache) : data;
|
|
43
|
+
cache.set(data, result);
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
getTrackedDisposables() {
|
|
47
|
+
const rootParentCache = ( new Map());
|
|
48
|
+
const leaking = [...this.livingDisposables.entries()]
|
|
49
|
+
.filter(([, v]) => v.source !== null && !this.getRootParent(v, rootParentCache).isSingleton)
|
|
50
|
+
.flatMap(([k]) => k);
|
|
51
|
+
return leaking;
|
|
52
|
+
}
|
|
53
|
+
computeLeakingDisposables(maxReported = 10, preComputedLeaks) {
|
|
54
|
+
let uncoveredLeakingObjs;
|
|
55
|
+
if (preComputedLeaks) {
|
|
56
|
+
uncoveredLeakingObjs = preComputedLeaks;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
const rootParentCache = ( new Map());
|
|
60
|
+
const leakingObjects = [...( this.livingDisposables.values())]
|
|
61
|
+
.filter((info) => info.source !== null && !this.getRootParent(info, rootParentCache).isSingleton);
|
|
62
|
+
if (leakingObjects.length === 0) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const leakingObjsSet = ( new Set(( leakingObjects.map(o => o.value))));
|
|
66
|
+
uncoveredLeakingObjs = leakingObjects.filter(l => {
|
|
67
|
+
return !(l.parent && ( leakingObjsSet.has(l.parent)));
|
|
68
|
+
});
|
|
69
|
+
if (uncoveredLeakingObjs.length === 0) {
|
|
70
|
+
throw new Error('There are cyclic diposable chains!');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (!uncoveredLeakingObjs) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
function getStackTracePath(leaking) {
|
|
77
|
+
function removePrefix(array, linesToRemove) {
|
|
78
|
+
while (array.length > 0 && ( linesToRemove.some(
|
|
79
|
+
regexp => typeof regexp === 'string' ? regexp === array[0] : array[0].match(regexp)
|
|
80
|
+
))) {
|
|
81
|
+
array.shift();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const lines = ( leaking.source.split('\n').map(p => p.trim().replace('at ', ''))).filter(l => l !== '');
|
|
85
|
+
removePrefix(lines, ['Error', /^trackDisposable \(.*\)$/, /^DisposableTracker.trackDisposable \(.*\)$/]);
|
|
86
|
+
return lines.reverse();
|
|
87
|
+
}
|
|
88
|
+
const stackTraceStarts = ( new SetMap());
|
|
89
|
+
for (const leaking of uncoveredLeakingObjs) {
|
|
90
|
+
const stackTracePath = getStackTracePath(leaking);
|
|
91
|
+
for (let i = 0; i <= stackTracePath.length; i++) {
|
|
92
|
+
stackTraceStarts.add(stackTracePath.slice(0, i).join('\n'), leaking);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
uncoveredLeakingObjs.sort(compareBy(l => l.idx, numberComparator));
|
|
96
|
+
let message = '';
|
|
97
|
+
let i = 0;
|
|
98
|
+
for (const leaking of uncoveredLeakingObjs.slice(0, maxReported)) {
|
|
99
|
+
i++;
|
|
100
|
+
const stackTracePath = getStackTracePath(leaking);
|
|
101
|
+
const stackTraceFormattedLines = [];
|
|
102
|
+
for (let i = 0; i < stackTracePath.length; i++) {
|
|
103
|
+
let line = stackTracePath[i];
|
|
104
|
+
const starts = stackTraceStarts.get(stackTracePath.slice(0, i + 1).join('\n'));
|
|
105
|
+
line = `(shared with ${starts.size}/${uncoveredLeakingObjs.length} leaks) at ${line}`;
|
|
106
|
+
const prevStarts = stackTraceStarts.get(stackTracePath.slice(0, i).join('\n'));
|
|
107
|
+
const continuations = groupBy(( [...prevStarts].map(d => getStackTracePath(d)[i])), v => v);
|
|
108
|
+
delete continuations[stackTracePath[i]];
|
|
109
|
+
for (const [cont, set] of Object.entries(continuations)) {
|
|
110
|
+
stackTraceFormattedLines.unshift(` - stacktraces of ${set.length} other leaks continue with ${cont}`);
|
|
111
|
+
}
|
|
112
|
+
stackTraceFormattedLines.unshift(line);
|
|
113
|
+
}
|
|
114
|
+
message += `\n\n\n==================== Leaking disposable ${i}/${uncoveredLeakingObjs.length}: ${leaking.value.constructor.name} ====================\n${stackTraceFormattedLines.join('\n')}\n============================================================\n\n`;
|
|
115
|
+
}
|
|
116
|
+
if (uncoveredLeakingObjs.length > maxReported) {
|
|
117
|
+
message += `\n\n\n... and ${uncoveredLeakingObjs.length - maxReported} more leaking disposables\n\n`;
|
|
118
|
+
}
|
|
119
|
+
return { leaks: uncoveredLeakingObjs, details: message };
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function setDisposableTracker(tracker) {
|
|
123
|
+
disposableTracker = tracker;
|
|
124
|
+
}
|
|
3
125
|
function trackDisposable(x) {
|
|
126
|
+
disposableTracker?.trackDisposable(x);
|
|
4
127
|
return x;
|
|
5
128
|
}
|
|
129
|
+
function markAsDisposed(disposable) {
|
|
130
|
+
disposableTracker?.markAsDisposed(disposable);
|
|
131
|
+
}
|
|
132
|
+
function setParentOfDisposable(child, parent) {
|
|
133
|
+
disposableTracker?.setParent(child, parent);
|
|
134
|
+
}
|
|
135
|
+
function setParentOfDisposables(children, parent) {
|
|
136
|
+
if (!disposableTracker) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
for (const child of children) {
|
|
140
|
+
disposableTracker.setParent(child, parent);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
6
143
|
function markAsSingleton(singleton) {
|
|
144
|
+
disposableTracker?.markAsSingleton(singleton);
|
|
7
145
|
return singleton;
|
|
8
146
|
}
|
|
9
147
|
function isDisposable(thing) {
|
|
@@ -45,11 +183,13 @@ function disposeIfDisposable(disposables) {
|
|
|
45
183
|
}
|
|
46
184
|
function combinedDisposable(...disposables) {
|
|
47
185
|
const parent = toDisposable(() => dispose(disposables));
|
|
186
|
+
setParentOfDisposables(disposables, parent);
|
|
48
187
|
return parent;
|
|
49
188
|
}
|
|
50
189
|
function toDisposable(fn) {
|
|
51
190
|
const self = trackDisposable({
|
|
52
191
|
dispose: createSingleCallFunction(() => {
|
|
192
|
+
markAsDisposed(self);
|
|
53
193
|
fn();
|
|
54
194
|
})
|
|
55
195
|
});
|
|
@@ -60,11 +200,13 @@ class DisposableStore {
|
|
|
60
200
|
constructor() {
|
|
61
201
|
this._toDispose = ( new Set());
|
|
62
202
|
this._isDisposed = false;
|
|
203
|
+
trackDisposable(this);
|
|
63
204
|
}
|
|
64
205
|
dispose() {
|
|
65
206
|
if (this._isDisposed) {
|
|
66
207
|
return;
|
|
67
208
|
}
|
|
209
|
+
markAsDisposed(this);
|
|
68
210
|
this._isDisposed = true;
|
|
69
211
|
this.clear();
|
|
70
212
|
}
|
|
@@ -89,6 +231,7 @@ class DisposableStore {
|
|
|
89
231
|
if (o === this) {
|
|
90
232
|
throw new Error('Cannot register a disposable on itself!');
|
|
91
233
|
}
|
|
234
|
+
setParentOfDisposable(o, this);
|
|
92
235
|
if (this._isDisposed) {
|
|
93
236
|
if (!DisposableStore.DISABLE_DISPOSED_WARNING) {
|
|
94
237
|
console.warn(( new Error(
|
|
@@ -117,6 +260,7 @@ class DisposableStore {
|
|
|
117
260
|
}
|
|
118
261
|
if (( this._toDispose.has(o))) {
|
|
119
262
|
this._toDispose.delete(o);
|
|
263
|
+
setParentOfDisposable(o, null);
|
|
120
264
|
}
|
|
121
265
|
}
|
|
122
266
|
}
|
|
@@ -124,8 +268,11 @@ class Disposable {
|
|
|
124
268
|
static { this.None = ( Object.freeze({ dispose() { } })); }
|
|
125
269
|
constructor() {
|
|
126
270
|
this._store = ( new DisposableStore());
|
|
271
|
+
trackDisposable(this);
|
|
272
|
+
setParentOfDisposable(this._store, this);
|
|
127
273
|
}
|
|
128
274
|
dispose() {
|
|
275
|
+
markAsDisposed(this);
|
|
129
276
|
this._store.dispose();
|
|
130
277
|
}
|
|
131
278
|
_register(o) {
|
|
@@ -138,6 +285,7 @@ class Disposable {
|
|
|
138
285
|
class MutableDisposable {
|
|
139
286
|
constructor() {
|
|
140
287
|
this._isDisposed = false;
|
|
288
|
+
trackDisposable(this);
|
|
141
289
|
}
|
|
142
290
|
get value() {
|
|
143
291
|
return this._isDisposed ? undefined : this._value;
|
|
@@ -147,6 +295,9 @@ class MutableDisposable {
|
|
|
147
295
|
return;
|
|
148
296
|
}
|
|
149
297
|
this._value?.dispose();
|
|
298
|
+
if (value) {
|
|
299
|
+
setParentOfDisposable(value, this);
|
|
300
|
+
}
|
|
150
301
|
this._value = value;
|
|
151
302
|
}
|
|
152
303
|
clear() {
|
|
@@ -154,12 +305,16 @@ class MutableDisposable {
|
|
|
154
305
|
}
|
|
155
306
|
dispose() {
|
|
156
307
|
this._isDisposed = true;
|
|
308
|
+
markAsDisposed(this);
|
|
157
309
|
this._value?.dispose();
|
|
158
310
|
this._value = undefined;
|
|
159
311
|
}
|
|
160
312
|
clearAndLeak() {
|
|
161
313
|
const oldValue = this._value;
|
|
162
314
|
this._value = undefined;
|
|
315
|
+
if (oldValue) {
|
|
316
|
+
setParentOfDisposable(oldValue, null);
|
|
317
|
+
}
|
|
163
318
|
return oldValue;
|
|
164
319
|
}
|
|
165
320
|
}
|
|
@@ -249,8 +404,10 @@ class DisposableMap {
|
|
|
249
404
|
constructor() {
|
|
250
405
|
this._store = ( new Map());
|
|
251
406
|
this._isDisposed = false;
|
|
407
|
+
trackDisposable(this);
|
|
252
408
|
}
|
|
253
409
|
dispose() {
|
|
410
|
+
markAsDisposed(this);
|
|
254
411
|
this._isDisposed = true;
|
|
255
412
|
this.clearAndDisposeAll();
|
|
256
413
|
}
|
|
@@ -299,4 +456,4 @@ class DisposableMap {
|
|
|
299
456
|
return this._store[Symbol.iterator]();
|
|
300
457
|
}
|
|
301
458
|
}
|
|
302
|
-
export { AsyncReferenceCollection, Disposable, DisposableMap, DisposableStore, ImmortalReference, MandatoryMutableDisposable, MutableDisposable, RefCountedDisposable, ReferenceCollection, combinedDisposable, dispose, disposeIfDisposable, isDisposable, markAsSingleton, toDisposable, trackDisposable };
|
|
459
|
+
export { AsyncReferenceCollection, Disposable, DisposableMap, DisposableStore, DisposableTracker, ImmortalReference, MandatoryMutableDisposable, MutableDisposable, RefCountedDisposable, ReferenceCollection, combinedDisposable, dispose, disposeIfDisposable, isDisposable, markAsDisposed, markAsSingleton, setDisposableTracker, toDisposable, trackDisposable };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertFn } from '../assert.js';
|
|
2
|
-
import { toDisposable, DisposableStore } from '../lifecycle.js';
|
|
2
|
+
import { toDisposable, DisposableStore, trackDisposable, markAsDisposed } from '../lifecycle.js';
|
|
3
3
|
import { DebugNameData } from './debugName.js';
|
|
4
4
|
function autorun(fn) {
|
|
5
5
|
return ( new AutorunObserver(( new DebugNameData(undefined, undefined, fn)), fn, undefined, undefined));
|
|
@@ -50,6 +50,7 @@ class AutorunObserver {
|
|
|
50
50
|
this.dependenciesToBeRemoved = ( new Set());
|
|
51
51
|
this.changeSummary = this.createChangeSummary?.();
|
|
52
52
|
this._runIfNeeded();
|
|
53
|
+
trackDisposable(this);
|
|
53
54
|
}
|
|
54
55
|
dispose() {
|
|
55
56
|
this.disposed = true;
|
|
@@ -57,6 +58,7 @@ class AutorunObserver {
|
|
|
57
58
|
o.removeObserver(this);
|
|
58
59
|
}
|
|
59
60
|
this.dependencies.clear();
|
|
61
|
+
markAsDisposed(this);
|
|
60
62
|
}
|
|
61
63
|
_runIfNeeded() {
|
|
62
64
|
if (this.state === 3 ) {
|
|
@@ -213,6 +213,9 @@ let WordHighlighter = class WordHighlighter {
|
|
|
213
213
|
this._onPositionChanged(e);
|
|
214
214
|
}));
|
|
215
215
|
this.toUnhook.add(editor.onDidFocusEditorText((e) => {
|
|
216
|
+
if (this.occurrencesHighlight === 'off') {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
216
219
|
if (!this.workerRequest) {
|
|
217
220
|
this._run();
|
|
218
221
|
}
|