@hydranium/client-theia 1.0.0-next.13 → 1.0.0-next.135
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 +35 -8
- package/lib/browser/channel-logger.d.ts +4 -3
- package/lib/browser/channel-logger.d.ts.map +1 -1
- package/lib/browser/channel-logger.js +9 -4
- package/lib/browser/channel-logger.js.map +1 -1
- package/lib/browser/connection-diagnostics-contribution.d.ts +69 -0
- package/lib/browser/connection-diagnostics-contribution.d.ts.map +1 -0
- package/lib/browser/connection-diagnostics-contribution.js +153 -0
- package/lib/browser/connection-diagnostics-contribution.js.map +1 -0
- package/lib/browser/editor-disk-sync.d.ts +133 -0
- package/lib/browser/editor-disk-sync.d.ts.map +1 -0
- package/lib/browser/editor-disk-sync.js +232 -0
- package/lib/browser/editor-disk-sync.js.map +1 -0
- package/lib/browser/hydranium-file-service.d.ts +44 -0
- package/lib/browser/hydranium-file-service.d.ts.map +1 -0
- package/lib/browser/hydranium-file-service.js +61 -0
- package/lib/browser/hydranium-file-service.js.map +1 -0
- package/lib/browser/index.d.ts +4 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +4 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/log-level-preference.d.ts.map +1 -1
- package/lib/browser/log-level-preference.js +11 -0
- package/lib/browser/log-level-preference.js.map +1 -1
- package/lib/browser/memory-diagnostics-contribution.d.ts +40 -4
- package/lib/browser/memory-diagnostics-contribution.d.ts.map +1 -1
- package/lib/browser/memory-diagnostics-contribution.js +161 -31
- package/lib/browser/memory-diagnostics-contribution.js.map +1 -1
- package/lib/browser/session-aware-connection-source.d.ts +98 -0
- package/lib/browser/session-aware-connection-source.d.ts.map +1 -0
- package/lib/browser/session-aware-connection-source.js +167 -0
- package/lib/browser/session-aware-connection-source.js.map +1 -0
- package/lib/common/clock.d.ts +19 -0
- package/lib/common/clock.d.ts.map +1 -0
- package/lib/common/clock.js +13 -0
- package/lib/common/clock.js.map +1 -0
- package/lib/common/connection-resilience-options.d.ts +24 -0
- package/lib/common/connection-resilience-options.d.ts.map +1 -0
- package/lib/common/connection-resilience-options.js +11 -0
- package/lib/common/connection-resilience-options.js.map +1 -0
- package/lib/common/framed-socket-write-buffer.d.ts +121 -0
- package/lib/common/framed-socket-write-buffer.d.ts.map +1 -0
- package/lib/common/framed-socket-write-buffer.js +190 -0
- package/lib/common/framed-socket-write-buffer.js.map +1 -0
- package/lib/common/index.d.ts +12 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +31 -0
- package/lib/common/index.js.map +1 -0
- package/lib/node/abstract-socket-forwarding-connection-handler.d.ts +8 -7
- package/lib/node/abstract-socket-forwarding-connection-handler.d.ts.map +1 -1
- package/lib/node/abstract-socket-forwarding-connection-handler.js +28 -7
- package/lib/node/abstract-socket-forwarding-connection-handler.js.map +1 -1
- package/lib/node/index.d.ts +2 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +2 -0
- package/lib/node/index.js.map +1 -1
- package/lib/node/session-bound-frontend-connection-service.d.ts +77 -0
- package/lib/node/session-bound-frontend-connection-service.d.ts.map +1 -0
- package/lib/node/session-bound-frontend-connection-service.js +128 -0
- package/lib/node/session-bound-frontend-connection-service.js.map +1 -0
- package/lib/node/socket-channel-forwarder.d.ts +54 -0
- package/lib/node/socket-channel-forwarder.d.ts.map +1 -0
- package/lib/node/socket-channel-forwarder.js +93 -0
- package/lib/node/socket-channel-forwarder.js.map +1 -0
- package/package.json +24 -9
- package/src/browser/channel-logger.ts +9 -4
- package/src/browser/connection-diagnostics-contribution.ts +142 -0
- package/src/browser/editor-disk-sync.ts +236 -0
- package/src/browser/hydranium-file-service.ts +56 -0
- package/src/browser/index.ts +4 -0
- package/src/browser/log-level-preference.ts +11 -0
- package/src/browser/memory-diagnostics-contribution.ts +268 -45
- package/src/browser/session-aware-connection-source.ts +179 -0
- package/src/common/clock.ts +20 -0
- package/src/common/connection-resilience-options.ts +24 -0
- package/src/common/framed-socket-write-buffer.ts +227 -0
- package/src/common/index.ts +15 -0
- package/src/node/abstract-socket-forwarding-connection-handler.ts +19 -9
- package/src/node/index.ts +2 -0
- package/src/node/session-bound-frontend-connection-service.ts +155 -0
- package/src/node/socket-channel-forwarder.ts +99 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.EditorDiskSync = void 0;
|
|
24
|
+
exports.isResyncableEditorDocument = isResyncableEditorDocument;
|
|
25
|
+
const protocol_1 = require("@hydranium/protocol");
|
|
26
|
+
const logger_1 = require("@theia/core/lib/common/logger");
|
|
27
|
+
const uri_1 = __importDefault(require("@theia/core/lib/common/uri"));
|
|
28
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
+
const editor_manager_1 = require("@theia/editor/lib/browser/editor-manager");
|
|
30
|
+
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
31
|
+
const clock_1 = require("../common/clock");
|
|
32
|
+
/** Whether `document` carries the members of {@link ResyncableEditorDocument}. */
|
|
33
|
+
function isResyncableEditorDocument(document) {
|
|
34
|
+
return ('uri' in document &&
|
|
35
|
+
typeof document.uri === 'string' &&
|
|
36
|
+
'dirty' in document &&
|
|
37
|
+
'getText' in document &&
|
|
38
|
+
typeof document.getText === 'function' &&
|
|
39
|
+
'revert' in document &&
|
|
40
|
+
typeof document.revert === 'function' &&
|
|
41
|
+
'contentChanges' in document &&
|
|
42
|
+
Array.isArray(document.contentChanges) &&
|
|
43
|
+
'resourceVersion' in document &&
|
|
44
|
+
'run' in document &&
|
|
45
|
+
typeof document.run === 'function' &&
|
|
46
|
+
'onModelWillSaveModel' in document &&
|
|
47
|
+
typeof document.onModelWillSaveModel === 'function');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Keeps a dirty editor's save from applying edits its file already holds, as
|
|
51
|
+
* the file does once the server saves a document the editor shows unsaved.
|
|
52
|
+
*
|
|
53
|
+
* Theia keeps such an editor dirty, and its next save corrupts the file: the
|
|
54
|
+
* save applies the editor's pending edits to the file rather than writing the
|
|
55
|
+
* whole text, and the file already holds them, so each is applied twice.
|
|
56
|
+
* Theia's check that the file has not changed since the editor read it passes
|
|
57
|
+
* whenever the new file has the old one's size, so no conflict is reported. A
|
|
58
|
+
* revert alone keeps the pending edits.
|
|
59
|
+
*
|
|
60
|
+
* Before each save of the editor it reads the file. When the file holds the
|
|
61
|
+
* text the buffer held as the save began, it drops the edits pending then and
|
|
62
|
+
* has the save expect the file's version, so the save writes only the edits
|
|
63
|
+
* made after that point, a save participant's included, onto the file as it
|
|
64
|
+
* is. The save is not cancelled: it completes and is reported as saved. Save
|
|
65
|
+
* All relies on this check, since it saves a diagram and then an editor on the
|
|
66
|
+
* same file at once, before the file watcher has reported the diagram's write.
|
|
67
|
+
* The buffer is taken when the save calls its will-save listeners. Theia runs
|
|
68
|
+
* its save participants one after another, each behind an await, and its
|
|
69
|
+
* first one awaits before it edits, so none has changed the buffer by then. A
|
|
70
|
+
* participant ordered ahead of it that edits before its first await makes the
|
|
71
|
+
* file and the taken text differ, and the save applies every edit again.
|
|
72
|
+
*
|
|
73
|
+
* On each change the file watcher reports, it marks the editor clean when the
|
|
74
|
+
* file holds exactly its buffer. The file is compared with the buffer after
|
|
75
|
+
* it has been read, and the editor is marked in the same step, so a keystroke
|
|
76
|
+
* made while the file was read leaves the editor dirty. This sync waits behind
|
|
77
|
+
* a save in flight: that save drops the edits it sent from the pending ones
|
|
78
|
+
* when it finishes, and a sync before then would have it drop the edits typed
|
|
79
|
+
* meanwhile.
|
|
80
|
+
*
|
|
81
|
+
* An editor whose file holds neither text is left to Theia's own save,
|
|
82
|
+
* same-size gap included, and so is one whose file cannot be read within
|
|
83
|
+
* {@link readTimeoutMs}, or whose check throws.
|
|
84
|
+
*
|
|
85
|
+
* The adopter binds it as a `FrontendApplicationContribution`.
|
|
86
|
+
*/
|
|
87
|
+
let EditorDiskSync = class EditorDiskSync {
|
|
88
|
+
fileService;
|
|
89
|
+
editorManager;
|
|
90
|
+
logger;
|
|
91
|
+
/** Times {@link readTimeoutMs}: the container's {@link Clock}, or a `SystemClock`. */
|
|
92
|
+
clock = new protocol_1.SystemClock();
|
|
93
|
+
/** Whether an editor's document has failed {@link isResyncableEditorDocument}; warned of once. */
|
|
94
|
+
warnedUnsyncable = false;
|
|
95
|
+
/**
|
|
96
|
+
* How long a check waits for the file. The editor's save, and every later
|
|
97
|
+
* save and sync of that editor, waits for the check.
|
|
98
|
+
*/
|
|
99
|
+
readTimeoutMs = 1_000;
|
|
100
|
+
onStart() {
|
|
101
|
+
this.fileService.onDidFilesChange(event => {
|
|
102
|
+
for (const change of event.changes) {
|
|
103
|
+
this.checkFile(change.resource);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
this.editorManager.onCreated(widget => this.guardSaves(widget));
|
|
107
|
+
for (const widget of this.editorManager.all) {
|
|
108
|
+
this.guardSaves(widget);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Check `widget`'s document before each of its saves, for as long as the widget lives. */
|
|
112
|
+
guardSaves(widget) {
|
|
113
|
+
const document = this.resyncable(widget.editor.document);
|
|
114
|
+
if (document) {
|
|
115
|
+
const registration = document.onModelWillSaveModel(() => this.isolate(() => this.dropChangesOnDisk(document)));
|
|
116
|
+
widget.onDidDispose(() => registration.dispose());
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Check each dirty document an editor shows on `uri`, behind that document's save in flight. */
|
|
120
|
+
checkFile(uri) {
|
|
121
|
+
for (const document of this.dirtyDocuments(uri)) {
|
|
122
|
+
void document.run(() => this.isolate(() => this.syncIfOnDisk(document)));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** Read the file of `document` if it is dirty, and sync it if the file holds its buffer. */
|
|
126
|
+
async syncIfOnDisk(document) {
|
|
127
|
+
if (!document.dirty) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const content = await this.readFile(document);
|
|
131
|
+
if (content && document.getText() === content.value) {
|
|
132
|
+
this.syncFromDisk(document, { etag: content.etag, mtime: content.mtime, encoding: content.encoding });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Before a save of `document`, drop the edits pending now if its file holds
|
|
137
|
+
* the buffer as it is now, and take the file's version. The buffer and the
|
|
138
|
+
* count are taken before the first await, while the save is still calling
|
|
139
|
+
* its will-save listeners; an edit made after that stays pending, and the
|
|
140
|
+
* save writes it onto the file.
|
|
141
|
+
*/
|
|
142
|
+
async dropChangesOnDisk(document) {
|
|
143
|
+
if (!document.dirty) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const text = document.getText();
|
|
147
|
+
const pending = document.contentChanges.length;
|
|
148
|
+
const content = await this.readFile(document);
|
|
149
|
+
if (content?.value === text) {
|
|
150
|
+
document.contentChanges.splice(0, pending);
|
|
151
|
+
document.resourceVersion = { etag: content.etag, mtime: content.mtime, encoding: content.encoding };
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The file of `document`, or `undefined` when it is gone, cannot be read, or
|
|
156
|
+
* is not read within {@link readTimeoutMs}.
|
|
157
|
+
*/
|
|
158
|
+
async readFile(document) {
|
|
159
|
+
const read = this.fileService.read(new uri_1.default(document.uri)).catch(() => undefined);
|
|
160
|
+
const content = await this.clock.raceTimer(read, this.readTimeoutMs);
|
|
161
|
+
return content === protocol_1.TIMED_OUT ? undefined : content;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Run `check`, and log its failure rather than pass it on. A will-save
|
|
165
|
+
* listener that rejects makes Theia drop the save without writing, and a
|
|
166
|
+
* sync that rejects goes unhandled.
|
|
167
|
+
*/
|
|
168
|
+
async isolate(check) {
|
|
169
|
+
try {
|
|
170
|
+
await check();
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
void this.logger.error('EditorDiskSync: checking an editor against its file failed; the editor is left as it is.', err);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/** The dirty documents open in an editor on `uri`, each once however many editors show it. */
|
|
177
|
+
dirtyDocuments(uri) {
|
|
178
|
+
const target = uri.toString();
|
|
179
|
+
const documents = new Set();
|
|
180
|
+
for (const widget of this.editorManager.all) {
|
|
181
|
+
const document = this.resyncable(widget.editor.document);
|
|
182
|
+
if (document && document.uri === target && document.dirty) {
|
|
183
|
+
documents.add(document);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return [...documents];
|
|
187
|
+
}
|
|
188
|
+
/** `document` if it carries the members the sync resets; otherwise `undefined`, warned of once. */
|
|
189
|
+
resyncable(document) {
|
|
190
|
+
if (isResyncableEditorDocument(document)) {
|
|
191
|
+
return document;
|
|
192
|
+
}
|
|
193
|
+
if (!this.warnedUnsyncable) {
|
|
194
|
+
this.warnedUnsyncable = true;
|
|
195
|
+
void this.logger.warn('EditorDiskSync: an editor document lacks the Monaco model members the sync resets, so such editors are not synced with their files.');
|
|
196
|
+
}
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Take `version` as the file `document` was last saved to, with nothing
|
|
201
|
+
* pending, and mark it clean. Synchronous throughout: a soft revert only
|
|
202
|
+
* marks the document clean, and reads nothing. The revert also cancels a
|
|
203
|
+
* save queued behind the sync, which would have written the same text.
|
|
204
|
+
*/
|
|
205
|
+
syncFromDisk(document, version) {
|
|
206
|
+
document.contentChanges.splice(0, document.contentChanges.length);
|
|
207
|
+
document.resourceVersion = version;
|
|
208
|
+
void document.revert({ soft: true });
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
exports.EditorDiskSync = EditorDiskSync;
|
|
212
|
+
__decorate([
|
|
213
|
+
(0, inversify_1.inject)(file_service_1.FileService),
|
|
214
|
+
__metadata("design:type", file_service_1.FileService)
|
|
215
|
+
], EditorDiskSync.prototype, "fileService", void 0);
|
|
216
|
+
__decorate([
|
|
217
|
+
(0, inversify_1.inject)(editor_manager_1.EditorManager),
|
|
218
|
+
__metadata("design:type", editor_manager_1.EditorManager)
|
|
219
|
+
], EditorDiskSync.prototype, "editorManager", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
(0, inversify_1.inject)(logger_1.ILogger),
|
|
222
|
+
__metadata("design:type", Object)
|
|
223
|
+
], EditorDiskSync.prototype, "logger", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
(0, inversify_1.inject)(clock_1.Clock),
|
|
226
|
+
(0, inversify_1.optional)(),
|
|
227
|
+
__metadata("design:type", Object)
|
|
228
|
+
], EditorDiskSync.prototype, "clock", void 0);
|
|
229
|
+
exports.EditorDiskSync = EditorDiskSync = __decorate([
|
|
230
|
+
(0, inversify_1.injectable)()
|
|
231
|
+
], EditorDiskSync);
|
|
232
|
+
//# sourceMappingURL=editor-disk-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-disk-sync.js","sourceRoot":"","sources":["../../src/browser/editor-disk-sync.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;AAoClF,gEAiBC;AAnDD,kDAA6D;AAE7D,0DAAwD;AACxD,qEAA6C;AAC7C,4DAA4E;AAC5E,6EAAyE;AAGzE,6EAA+F;AAC/F,2CAAwC;AAwBxC,kFAAkF;AAClF,SAAgB,0BAA0B,CAAC,QAAgB;IACxD,OAAO,CACJ,KAAK,IAAI,QAAQ;QACjB,OAAO,QAAQ,CAAC,GAAG,KAAK,QAAQ;QAChC,OAAO,IAAI,QAAQ;QACnB,SAAS,IAAI,QAAQ;QACrB,OAAO,QAAQ,CAAC,OAAO,KAAK,UAAU;QACtC,QAAQ,IAAI,QAAQ;QACpB,OAAO,QAAQ,CAAC,MAAM,KAAK,UAAU;QACrC,gBAAgB,IAAI,QAAQ;QAC5B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;QACtC,iBAAiB,IAAI,QAAQ;QAC7B,KAAK,IAAI,QAAQ;QACjB,OAAO,QAAQ,CAAC,GAAG,KAAK,UAAU;QAClC,sBAAsB,IAAI,QAAQ;QAClC,OAAO,QAAQ,CAAC,oBAAoB,KAAK,UAAU,CACrD,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAc;IACgB,WAAW,CAAe;IACxB,aAAa,CAAiB;IACpC,MAAM,CAAW;IACrD,sFAAsF;IACxC,KAAK,GAAU,IAAI,sBAAW,EAAE,CAAC;IAC/E,kGAAkG;IACxF,gBAAgB,GAAG,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AO,QAAQ,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC1B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,KAAK,IAAI,CAAC,MAAM,CAAC,IAAI,CAClB,qIAAqI,CACvI,CAAC;QACL,CAAC;QACD,OAAO,SAAS,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACO,YAAY,CAAC,QAAkC,EAAE,OAA4B;QACpF,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAClE,QAAQ,CAAC,eAAe,GAAG,OAAO,CAAC;QACnC,KAAK,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACxC,CAAC;CACH,CAAA;AAtIY,wCAAc;AACgB;IAAvC,IAAA,kBAAM,EAAC,0BAAW,CAAC;8BAAkC,0BAAW;mDAAC;AACxB;IAAzC,IAAA,kBAAM,EAAC,8BAAa,CAAC;8BAAoC,8BAAa;qDAAC;AACpC;IAAnC,IAAA,kBAAM,EAAC,gBAAO,CAAC;;8CAAqC;AAEP;IAA7C,IAAA,kBAAM,EAAC,aAAK,CAAC;IAAE,IAAA,oBAAQ,GAAE;;6CAAqD;yBALrE,cAAc;IAD1B,IAAA,sBAAU,GAAE;GACA,cAAc,CAsI1B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the MIT License which is available in the project root.
|
|
6
|
+
*
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
********************************************************************************/
|
|
9
|
+
import type URI from '@theia/core/lib/common/uri';
|
|
10
|
+
import { FileService, type UpdateTextFileOptions } from '@theia/filesystem/lib/browser/file-service';
|
|
11
|
+
/**
|
|
12
|
+
* Theia's `FileService`, refusing an incremental save once the file has
|
|
13
|
+
* changed since the editor read it.
|
|
14
|
+
*
|
|
15
|
+
* Theia's own check, which `write` and `update` share, passes a file whose
|
|
16
|
+
* mtime moved on when its size still matches the etag the editor read. That
|
|
17
|
+
* is safe for `write`, which replaces the file with the whole text, but
|
|
18
|
+
* `update` applies the editor's pending edits to the file as it is, so after a
|
|
19
|
+
* same-size change, the server saving those very edits included, it applies
|
|
20
|
+
* them a second time. Here `update` hands that check the etag with a `!`
|
|
21
|
+
* appended, which no file's etag can match: Theia writes an etag as the mtime
|
|
22
|
+
* in base 29 followed by the size in base 31, digits and lower-case letters
|
|
23
|
+
* only. An advanced mtime is then enough for Theia to refuse with its
|
|
24
|
+
* `FILE_MODIFIED_SINCE`. The editor's save then falls back to `write` with the
|
|
25
|
+
* whole text, which Theia checks as before: it writes when the size is
|
|
26
|
+
* unchanged, and asks the user otherwise. A same-size change by another
|
|
27
|
+
* process is therefore overwritten by that write rather than merged with the
|
|
28
|
+
* editor's edits. `write` is left as it is.
|
|
29
|
+
*
|
|
30
|
+
* It is the safety net behind `EditorDiskSync`, which acts only when the
|
|
31
|
+
* file holds the editor's buffer: a file holding some of the edits, as when a
|
|
32
|
+
* save participant ordered ahead of Theia's first one edits before its first
|
|
33
|
+
* await, is left to this check.
|
|
34
|
+
*
|
|
35
|
+
* A write within the file system's mtime resolution of the read goes unseen,
|
|
36
|
+
* as it does for Theia's own check. A file whose mtime moves while its text
|
|
37
|
+
* stays the same costs a whole-text write rather than the edits.
|
|
38
|
+
*
|
|
39
|
+
* The adopter binds it with `rebind(FileService).to(HydraniumFileService).inSingletonScope()`.
|
|
40
|
+
*/
|
|
41
|
+
export declare class HydraniumFileService extends FileService {
|
|
42
|
+
update(resource: URI, changes: Parameters<FileService['update']>[1], options: UpdateTextFileOptions): ReturnType<FileService['update']>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=hydranium-file-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-file-service.d.ts","sourceRoot":"","sources":["../../src/browser/hydranium-file-service.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,KAAK,GAAG,MAAM,4BAA4B,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,KAAK,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAGrG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBACa,oBAAqB,SAAQ,WAAW;IACzC,MAAM,CACZ,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAC7C,OAAO,EAAE,qBAAqB,GAC9B,UAAU,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;CAKtC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made available under the
|
|
6
|
+
* terms of the MIT License which is available in the project root.
|
|
7
|
+
*
|
|
8
|
+
* SPDX-License-Identifier: MIT
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HydraniumFileService = void 0;
|
|
18
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
19
|
+
const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
|
|
20
|
+
const files_1 = require("@theia/filesystem/lib/common/files");
|
|
21
|
+
/**
|
|
22
|
+
* Theia's `FileService`, refusing an incremental save once the file has
|
|
23
|
+
* changed since the editor read it.
|
|
24
|
+
*
|
|
25
|
+
* Theia's own check, which `write` and `update` share, passes a file whose
|
|
26
|
+
* mtime moved on when its size still matches the etag the editor read. That
|
|
27
|
+
* is safe for `write`, which replaces the file with the whole text, but
|
|
28
|
+
* `update` applies the editor's pending edits to the file as it is, so after a
|
|
29
|
+
* same-size change, the server saving those very edits included, it applies
|
|
30
|
+
* them a second time. Here `update` hands that check the etag with a `!`
|
|
31
|
+
* appended, which no file's etag can match: Theia writes an etag as the mtime
|
|
32
|
+
* in base 29 followed by the size in base 31, digits and lower-case letters
|
|
33
|
+
* only. An advanced mtime is then enough for Theia to refuse with its
|
|
34
|
+
* `FILE_MODIFIED_SINCE`. The editor's save then falls back to `write` with the
|
|
35
|
+
* whole text, which Theia checks as before: it writes when the size is
|
|
36
|
+
* unchanged, and asks the user otherwise. A same-size change by another
|
|
37
|
+
* process is therefore overwritten by that write rather than merged with the
|
|
38
|
+
* editor's edits. `write` is left as it is.
|
|
39
|
+
*
|
|
40
|
+
* It is the safety net behind `EditorDiskSync`, which acts only when the
|
|
41
|
+
* file holds the editor's buffer: a file holding some of the edits, as when a
|
|
42
|
+
* save participant ordered ahead of Theia's first one edits before its first
|
|
43
|
+
* await, is left to this check.
|
|
44
|
+
*
|
|
45
|
+
* A write within the file system's mtime resolution of the read goes unseen,
|
|
46
|
+
* as it does for Theia's own check. A file whose mtime moves while its text
|
|
47
|
+
* stays the same costs a whole-text write rather than the edits.
|
|
48
|
+
*
|
|
49
|
+
* The adopter binds it with `rebind(FileService).to(HydraniumFileService).inSingletonScope()`.
|
|
50
|
+
*/
|
|
51
|
+
let HydraniumFileService = class HydraniumFileService extends file_service_1.FileService {
|
|
52
|
+
update(resource, changes, options) {
|
|
53
|
+
const strict = typeof options.etag === 'string' && options.etag !== files_1.ETAG_DISABLED ? { ...options, etag: `${options.etag}!` } : options;
|
|
54
|
+
return super.update(resource, changes, strict);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.HydraniumFileService = HydraniumFileService;
|
|
58
|
+
exports.HydraniumFileService = HydraniumFileService = __decorate([
|
|
59
|
+
(0, inversify_1.injectable)()
|
|
60
|
+
], HydraniumFileService);
|
|
61
|
+
//# sourceMappingURL=hydranium-file-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydranium-file-service.js","sourceRoot":"","sources":["../../src/browser/hydranium-file-service.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;AAGlF,4DAA0D;AAC1D,6EAAqG;AACrG,8DAAmE;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,0BAAW;IACzC,MAAM,CACZ,QAAa,EACb,OAA6C,EAC7C,OAA8B;QAE9B,MAAM,MAAM,GACT,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,qBAAa,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAC3H,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;CACH,CAAA;AAVY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CAUhC"}
|
package/lib/browser/index.d.ts
CHANGED
|
@@ -10,4 +10,8 @@ export * from './channel-logger';
|
|
|
10
10
|
export * from './log-level-preference';
|
|
11
11
|
export * from './browser-capture';
|
|
12
12
|
export * from './memory-diagnostics-contribution';
|
|
13
|
+
export * from './session-aware-connection-source';
|
|
14
|
+
export * from './connection-diagnostics-contribution';
|
|
15
|
+
export * from './editor-disk-sync';
|
|
16
|
+
export * from './hydranium-file-service';
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAGlF,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC"}
|
package/lib/browser/index.js
CHANGED
|
@@ -27,4 +27,8 @@ __exportStar(require("./channel-logger"), exports);
|
|
|
27
27
|
__exportStar(require("./log-level-preference"), exports);
|
|
28
28
|
__exportStar(require("./browser-capture"), exports);
|
|
29
29
|
__exportStar(require("./memory-diagnostics-contribution"), exports);
|
|
30
|
+
__exportStar(require("./session-aware-connection-source"), exports);
|
|
31
|
+
__exportStar(require("./connection-diagnostics-contribution"), exports);
|
|
32
|
+
__exportStar(require("./editor-disk-sync"), exports);
|
|
33
|
+
__exportStar(require("./hydranium-file-service"), exports);
|
|
30
34
|
//# sourceMappingURL=index.js.map
|
package/lib/browser/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,mDAAiC;AACjC,yDAAuC;AACvC,oDAAkC;AAClC,oEAAkD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;;;;;AAElF,gFAAgF;AAChF,mDAAiC;AACjC,yDAAuC;AACvC,oDAAkC;AAClC,oEAAkD;AAClD,oEAAkD;AAClD,wEAAsD;AACtD,qDAAmC;AACnC,2DAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-level-preference.d.ts","sourceRoot":"","sources":["../../src/browser/log-level-preference.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAAE,oBAAoB,EAAyB,MAAM,qBAAqB,CAAC;AAIlF,OAAO,EAAE,+BAA+B,EAAE,MAAM,2DAA2D,CAAC;AAC5G,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAC1F,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEnF,4FAA4F;AAC5F,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,8BAA+B,YAAW,+BAA+B;IACvD,SAAS,CAAC,QAAQ,CAAC,cAAc,EAAG,MAAM,CAAC;IAC5C,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAG,iBAAiB,CAAC;IAC7D,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAC;IAErD;;gEAE4D;IAC5D,SAAS,CAAC,QAAQ,CAAC,SAAS,uBAA8B;IAC1D;;mBAEe;IACf,SAAS,CAAC,UAAU,UAAS;IAE7B;;;;;;;;;;OAUG;IACH,OAAO,IAAI,IAAI;IAIf;yEACqE;c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+111,18 @@ let LogLevelPreferenceContribution = class LogLevelPreferenceContribution {
|
|
|
111
111
|
applyLevel() {
|
|
112
112
|
const level = (0, protocol_1.parseLogLevel)(this.preferences.get(this.preferenceName));
|
|
113
113
|
if (level) {
|
|
114
|
+
const previous = protocol_1.Logger.getLevel();
|
|
114
115
|
protocol_1.Logger.setLevel(level);
|
|
116
|
+
if (previous !== level) {
|
|
117
|
+
// Through Theia's `ILogger`, which has a threshold of its own and so
|
|
118
|
+
// is not silenced by the value just applied — the framework logger
|
|
119
|
+
// this preference governs would drop the line on a switch to `error`.
|
|
120
|
+
//
|
|
121
|
+
// Frontend and server announce separately: this preference reaches
|
|
122
|
+
// the server only if a client delivers it as configuration, so one
|
|
123
|
+
// line without the other says it did not.
|
|
124
|
+
this.logger.info(`Log level ${previous} → ${level} (preference '${this.preferenceName}')`);
|
|
125
|
+
}
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-level-preference.js","sourceRoot":"","sources":["../../src/browser/log-level-preference.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"log-level-preference.js","sourceRoot":"","sources":["../../src/browser/log-level-preference.ts"],"names":[],"mappings":";AAAA;;;;;;;kFAOkF;;;;;;;;;;;;AA8HlF,wDAIC;AAhID,kDAAkF;AAClF,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,iHAA4G;AAC5G,0DAAwD;AACxD,8FAA0F;AAC1F,4DAAmF;AAEnF,4FAA4F;AAC/E,QAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IACO,cAAc,CAAU;IACzB,WAAW,CAAqB;IAC1C,MAAM,CAAW;IAErD;;gEAE4D;IACzC,SAAS,GAAG,IAAI,+B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CAAC;gBACtB,qEAAqE;gBACrE,mEAAmE;gBACnE,sEAAsE;gBACtE,EAAE;gBACF,mEAAmE;gBACnE,mEAAmE;gBACnE,0CAA0C;gBAC1C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,QAAQ,MAAM,KAAK,iBAAiB,IAAI,CAAC,cAAc,IAAI,CAAC,CAAC;YAC9F,CAAC;QACJ,CAAC;IACJ,CAAC;CACH,CAAA;AAjFY,wEAA8B;AACO;IAA9C,IAAA,kBAAM,EAAC,0BAAkB,CAAC;;sEAA4C;AACzB;IAA7C,IAAA,kBAAM,EAAC,sCAAiB,CAAC;;mEAAoD;AAC1C;IAAnC,IAAA,kBAAM,EAAC,gBAAO,CAAC;;8DAAqC;yCAH3C,8BAA8B;IAD1C,IAAA,sBAAU,GAAE;GACA,8BAA8B,CAiF1C;AAED;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAC,IAAqB,EAAE,cAAsB;IACjF,IAAI,CAAC,0BAAkB,CAAC,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IACzD,IAAI,CAAC,8BAA8B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACjE,IAAI,CAAC,mEAA+B,CAAC,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -43,6 +43,15 @@ export declare const MemoryDiagnosticsService: unique symbol;
|
|
|
43
43
|
*/
|
|
44
44
|
export type HostMemoryDiagnosticsService = HostDiagnosticsProtocol;
|
|
45
45
|
export declare const HostMemoryDiagnosticsService: unique symbol;
|
|
46
|
+
/**
|
|
47
|
+
* What a `report` call captured, as a code rather than a prose fragment. The
|
|
48
|
+
* sentences it appears in are authored once per code, because a fragment
|
|
49
|
+
* substituted into a sentence is itself translatable text and a translator
|
|
50
|
+
* given the sentence alone cannot inflect around a hole.
|
|
51
|
+
*/
|
|
52
|
+
export type DiagnosticsSubject = 'server-state' | 'pod-memory' | 'latency' | 'backend-state' | 'profile';
|
|
53
|
+
/** Which process a heap snapshot is taken of; a code, for the reason {@link DiagnosticsSubject} is one. */
|
|
54
|
+
export type HeapSnapshotTarget = 'server' | 'backend';
|
|
46
55
|
/**
|
|
47
56
|
* Memory-diagnostics commands, one per layer reachable from the frontend. Full
|
|
48
57
|
* multi-line snapshots are appended to the configured output channel; a one-line
|
|
@@ -77,14 +86,28 @@ export declare class MemoryDiagnosticsContribution implements CommandContributio
|
|
|
77
86
|
*/
|
|
78
87
|
protected readonly stopProfilingLabel: string;
|
|
79
88
|
registerCommands(registry: CommandRegistry): void;
|
|
80
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Takes an object rather than positional arguments so that `label` — the one
|
|
91
|
+
* user-facing member — is addressable by name. A lint rule guarding the
|
|
92
|
+
* localization of labels has only syntax to work with, and a selector for an
|
|
93
|
+
* argument position would equally catch `id`, which must stay a bare literal.
|
|
94
|
+
*/
|
|
95
|
+
protected command(spec: {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
category: string;
|
|
99
|
+
}): Command;
|
|
100
|
+
/** The record window as whole seconds, for the label and the toast that must agree on it. */
|
|
101
|
+
protected recordDurationSeconds(): number;
|
|
81
102
|
/** Run a snapshot call, append the full result to the channel, toast the first matching summary line. */
|
|
82
|
-
protected report(
|
|
83
|
-
protected writeSnapshot(target:
|
|
103
|
+
protected report(subject: DiagnosticsSubject, produce: () => Promise<string>, summaryKeys: string[]): Promise<void>;
|
|
104
|
+
protected writeSnapshot(target: HeapSnapshotTarget, produce: (label: string) => Promise<string>): Promise<void>;
|
|
84
105
|
/** Begin an open-ended capture; the toast's stop action ends it and reports. */
|
|
85
106
|
protected startProfiling(): Promise<void>;
|
|
86
107
|
/** End the capture and report it. Shared, so the toast action and the command cannot diverge in behaviour. */
|
|
87
108
|
protected stopProfiling(): Promise<void>;
|
|
109
|
+
/** One authored sentence for both start paths; identical literals in two places drift apart under translation. */
|
|
110
|
+
protected startProfilingFailedMessage(detail: string): string;
|
|
88
111
|
/** Capture a fixed-length window: start, wait, stop, and report the result. */
|
|
89
112
|
protected recordProfile(): Promise<void>;
|
|
90
113
|
/** Isolated so tests can drive the record window without a real timer. */
|
|
@@ -92,7 +115,20 @@ export declare class MemoryDiagnosticsContribution implements CommandContributio
|
|
|
92
115
|
protected dumpFrontendState(): Promise<void>;
|
|
93
116
|
protected channel(): OutputChannel;
|
|
94
117
|
/** Pull the first line starting with one of `keys` for a one-line toast; full text is in the channel. */
|
|
95
|
-
protected summarize(snapshot: string,
|
|
118
|
+
protected summarize(snapshot: string, subject: DiagnosticsSubject, keys: string[]): string;
|
|
119
|
+
/**
|
|
120
|
+
* The captured-with-detail toast. The detail is a machine-formatted figure,
|
|
121
|
+
* so it is safe as a substitution parameter; the subject is not, hence one
|
|
122
|
+
* authored sentence per subject.
|
|
123
|
+
*/
|
|
124
|
+
protected capturedDetailMessage(subject: DiagnosticsSubject, detail: string): string;
|
|
125
|
+
/** The captured-without-detail toast; the channel name is adopter branding, not translatable text. */
|
|
126
|
+
protected capturedChannelMessage(subject: DiagnosticsSubject): string;
|
|
127
|
+
/** The failed-to-dump toast; the detail is a technical error string, safe as a parameter. */
|
|
128
|
+
protected dumpFailedMessage(subject: DiagnosticsSubject, detail: string): string;
|
|
129
|
+
protected writingSnapshotMessage(target: HeapSnapshotTarget): string;
|
|
130
|
+
protected wroteSnapshotMessage(target: HeapSnapshotTarget, filePath: string): string;
|
|
131
|
+
protected writeSnapshotFailedMessage(target: HeapSnapshotTarget, detail: string): string;
|
|
96
132
|
protected errorMessage(error: unknown): string;
|
|
97
133
|
}
|
|
98
134
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-diagnostics-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/memory-diagnostics-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;kFAOkF;AAElF,OAAO,EAEJ,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACzB,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