@jupyterlab/lsp 4.0.0-alpha.11
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/lib/adapters/adapter.d.ts +125 -0
- package/lib/adapters/adapter.js +382 -0
- package/lib/adapters/adapter.js.map +1 -0
- package/lib/connection.d.ts +65 -0
- package/lib/connection.js +309 -0
- package/lib/connection.js.map +1 -0
- package/lib/connection_manager.d.ts +71 -0
- package/lib/connection_manager.js +312 -0
- package/lib/connection_manager.js.map +1 -0
- package/lib/extractors/manager.d.ts +13 -0
- package/lib/extractors/manager.js +44 -0
- package/lib/extractors/manager.js.map +1 -0
- package/lib/extractors/text_extractor.d.ts +28 -0
- package/lib/extractors/text_extractor.js +27 -0
- package/lib/extractors/text_extractor.js.map +1 -0
- package/lib/extractors/types.d.ts +65 -0
- package/lib/extractors/types.js +2 -0
- package/lib/extractors/types.js.map +1 -0
- package/lib/feature.d.ts +11 -0
- package/lib/feature.js +31 -0
- package/lib/feature.js.map +1 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +22 -0
- package/lib/index.js.map +1 -0
- package/lib/lsp.d.ts +129 -0
- package/lib/lsp.js +125 -0
- package/lib/lsp.js.map +1 -0
- package/lib/manager.d.ts +29 -0
- package/lib/manager.js +130 -0
- package/lib/manager.js.map +1 -0
- package/lib/plugin.d.ts +45 -0
- package/lib/plugin.js +3 -0
- package/lib/plugin.js.map +1 -0
- package/lib/positioning.d.ts +28 -0
- package/lib/positioning.js +49 -0
- package/lib/positioning.js.map +1 -0
- package/lib/schema.d.ts +228 -0
- package/lib/schema.js +3 -0
- package/lib/schema.js.map +1 -0
- package/lib/tokens.d.ts +368 -0
- package/lib/tokens.js +58 -0
- package/lib/tokens.js.map +1 -0
- package/lib/utils.d.ts +18 -0
- package/lib/utils.js +71 -0
- package/lib/utils.js.map +1 -0
- package/lib/virtual/document.d.ts +270 -0
- package/lib/virtual/document.js +600 -0
- package/lib/virtual/document.js.map +1 -0
- package/package.json +75 -0
- package/style/index.css +11 -0
- package/style/index.js +11 -0
|
@@ -0,0 +1,600 @@
|
|
|
1
|
+
import { Signal } from '@lumino/signaling';
|
|
2
|
+
import { DocumentConnectionManager } from '../connection_manager';
|
|
3
|
+
import { PositionError } from '../positioning';
|
|
4
|
+
import { DefaultMap, untilReady } from '../utils';
|
|
5
|
+
/**
|
|
6
|
+
* Check if given position is within range.
|
|
7
|
+
* Both start and end are inclusive.
|
|
8
|
+
* @param position
|
|
9
|
+
* @param range
|
|
10
|
+
*/
|
|
11
|
+
export function isWithinRange(position, range) {
|
|
12
|
+
if (range.start.line === range.end.line) {
|
|
13
|
+
return (position.line === range.start.line &&
|
|
14
|
+
position.column >= range.start.column &&
|
|
15
|
+
position.column <= range.end.column);
|
|
16
|
+
}
|
|
17
|
+
return ((position.line === range.start.line &&
|
|
18
|
+
position.column >= range.start.column &&
|
|
19
|
+
position.line < range.end.line) ||
|
|
20
|
+
(position.line > range.start.line &&
|
|
21
|
+
position.column <= range.end.column &&
|
|
22
|
+
position.line === range.end.line) ||
|
|
23
|
+
(position.line > range.start.line && position.line < range.end.line));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* a virtual implementation of IDocumentInfo
|
|
27
|
+
*/
|
|
28
|
+
export class VirtualDocumentInfo {
|
|
29
|
+
constructor(document) {
|
|
30
|
+
this.version = 0;
|
|
31
|
+
this._document = document;
|
|
32
|
+
}
|
|
33
|
+
get text() {
|
|
34
|
+
return this._document.value;
|
|
35
|
+
}
|
|
36
|
+
get uri() {
|
|
37
|
+
const uris = DocumentConnectionManager.solveUris(this._document, this.languageId);
|
|
38
|
+
return uris.document;
|
|
39
|
+
}
|
|
40
|
+
get languageId() {
|
|
41
|
+
return this._document.language;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A notebook can hold one or more virtual documents; there is always one,
|
|
46
|
+
* "root" document, corresponding to the language of the kernel. All other
|
|
47
|
+
* virtual documents are extracted out of the notebook, based on magics,
|
|
48
|
+
* or other syntax constructs, depending on the kernel language.
|
|
49
|
+
*
|
|
50
|
+
* Virtual documents represent the underlying code in a single language,
|
|
51
|
+
* which has been parsed excluding interactive kernel commands (magics)
|
|
52
|
+
* which could be misunderstood by the specific LSP server.
|
|
53
|
+
*
|
|
54
|
+
* VirtualDocument has no awareness of the notebook or editor it lives in,
|
|
55
|
+
* however it is able to transform its content back to the notebook space,
|
|
56
|
+
* as it keeps editor coordinates for each virtual line.
|
|
57
|
+
*
|
|
58
|
+
* The notebook/editor aware transformations are preferred to be placed in
|
|
59
|
+
* VirtualEditor descendants rather than here.
|
|
60
|
+
*
|
|
61
|
+
* No dependency on editor implementation (such as CodeMirrorEditor)
|
|
62
|
+
* is allowed for VirtualEditor.
|
|
63
|
+
*/
|
|
64
|
+
export class VirtualDocument {
|
|
65
|
+
constructor(options) {
|
|
66
|
+
this.isDisposed = false;
|
|
67
|
+
this.blankLinesBetweenCells = 2;
|
|
68
|
+
this.options = options;
|
|
69
|
+
this.path = this.options.path;
|
|
70
|
+
this.fileExtension = options.fileExtension;
|
|
71
|
+
this.hasLspSupportedFile = options.hasLspSupportedFile;
|
|
72
|
+
this.parent = options.parent;
|
|
73
|
+
this.language = options.language;
|
|
74
|
+
this.virtualLines = new Map();
|
|
75
|
+
this.sourceLines = new Map();
|
|
76
|
+
this.foreignDocuments = new Map();
|
|
77
|
+
this._editorToSourceLine = new Map();
|
|
78
|
+
this._foreignCodeExtractors = options.foreignCodeExtractors;
|
|
79
|
+
this.standalone = options.standalone || false;
|
|
80
|
+
this.instanceId = VirtualDocument.instancesCount;
|
|
81
|
+
VirtualDocument.instancesCount += 1;
|
|
82
|
+
this.unusedStandaloneDocuments = new DefaultMap(() => new Array());
|
|
83
|
+
this._remainingLifetime = 6;
|
|
84
|
+
this.foreignDocumentClosed = new Signal(this);
|
|
85
|
+
this.foreignDocumentOpened = new Signal(this);
|
|
86
|
+
this.changed = new Signal(this);
|
|
87
|
+
this.unusedDocuments = new Set();
|
|
88
|
+
this.documentInfo = new VirtualDocumentInfo(this);
|
|
89
|
+
this.updateManager = new UpdateManager(this);
|
|
90
|
+
this.updateManager.updateBegan.connect(() => {
|
|
91
|
+
this._editorToSourceLineNew = new Map();
|
|
92
|
+
}, this);
|
|
93
|
+
this.updateManager.blockAdded.connect((_, blockData) => {
|
|
94
|
+
this._editorToSourceLineNew.set(blockData.block.ceEditor, blockData.virtualDocument.lastSourceLine);
|
|
95
|
+
}, this);
|
|
96
|
+
this.updateManager.updateFinished.connect(() => {
|
|
97
|
+
this._editorToSourceLine = this._editorToSourceLineNew;
|
|
98
|
+
}, this);
|
|
99
|
+
this.clear();
|
|
100
|
+
}
|
|
101
|
+
dispose() {
|
|
102
|
+
if (this.isDisposed) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.isDisposed = true;
|
|
106
|
+
this.parent = null;
|
|
107
|
+
this.closeAllForeignDocuments();
|
|
108
|
+
this.updateManager.dispose();
|
|
109
|
+
// clear all the maps
|
|
110
|
+
this.foreignDocuments.clear();
|
|
111
|
+
this.sourceLines.clear();
|
|
112
|
+
this.unusedDocuments.clear();
|
|
113
|
+
this.unusedStandaloneDocuments.clear();
|
|
114
|
+
this.virtualLines.clear();
|
|
115
|
+
// just to be sure - if anything is accessed after disposal (it should not) we
|
|
116
|
+
// will get alterted by errors in the console AND this will limit memory leaks
|
|
117
|
+
this.documentInfo = null;
|
|
118
|
+
this.lineBlocks = null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* When this counter goes down to 0, the document will be destroyed and the associated connection will be closed;
|
|
122
|
+
* This is meant to reduce the number of open connections when a a foreign code snippet was removed from the document.
|
|
123
|
+
*
|
|
124
|
+
* Note: top level virtual documents are currently immortal (unless killed by other means); it might be worth
|
|
125
|
+
* implementing culling of unused documents, but if and only if JupyterLab will also implement culling of
|
|
126
|
+
* idle kernels - otherwise the user experience could be a bit inconsistent, and we would need to invent our own rules.
|
|
127
|
+
*/
|
|
128
|
+
get remainingLifetime() {
|
|
129
|
+
if (!this.parent) {
|
|
130
|
+
return Infinity;
|
|
131
|
+
}
|
|
132
|
+
return this._remainingLifetime;
|
|
133
|
+
}
|
|
134
|
+
set remainingLifetime(value) {
|
|
135
|
+
if (this.parent) {
|
|
136
|
+
this._remainingLifetime = value;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
clear() {
|
|
140
|
+
for (let document of this.foreignDocuments.values()) {
|
|
141
|
+
document.clear();
|
|
142
|
+
}
|
|
143
|
+
// TODO - deep clear (assure that there is no memory leak)
|
|
144
|
+
this.unusedStandaloneDocuments.clear();
|
|
145
|
+
this.unusedDocuments = new Set();
|
|
146
|
+
this.virtualLines.clear();
|
|
147
|
+
this.sourceLines.clear();
|
|
148
|
+
this.lastVirtualLine = 0;
|
|
149
|
+
this.lastSourceLine = 0;
|
|
150
|
+
this.lineBlocks = [];
|
|
151
|
+
}
|
|
152
|
+
documentAtSourcePosition(position) {
|
|
153
|
+
let sourceLine = this.sourceLines.get(position.line);
|
|
154
|
+
if (sourceLine == null) {
|
|
155
|
+
return this;
|
|
156
|
+
}
|
|
157
|
+
let sourcePositionCe = {
|
|
158
|
+
line: sourceLine.editorLine,
|
|
159
|
+
column: position.ch
|
|
160
|
+
};
|
|
161
|
+
for (let [range, { virtualDocument: document }] of sourceLine.foreignDocumentsMap) {
|
|
162
|
+
if (isWithinRange(sourcePositionCe, range)) {
|
|
163
|
+
let sourcePositionCm = {
|
|
164
|
+
line: sourcePositionCe.line - range.start.line,
|
|
165
|
+
ch: sourcePositionCe.column - range.start.column
|
|
166
|
+
};
|
|
167
|
+
return document.documentAtSourcePosition(sourcePositionCm);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
isWithinForeign(sourcePosition) {
|
|
173
|
+
let sourceLine = this.sourceLines.get(sourcePosition.line);
|
|
174
|
+
let sourcePositionCe = {
|
|
175
|
+
line: sourceLine.editorLine,
|
|
176
|
+
column: sourcePosition.ch
|
|
177
|
+
};
|
|
178
|
+
for (let [range] of sourceLine.foreignDocumentsMap) {
|
|
179
|
+
if (isWithinRange(sourcePositionCe, range)) {
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
transformFromEditorToRoot(editor, position) {
|
|
186
|
+
if (!this._editorToSourceLine.has(editor)) {
|
|
187
|
+
console.log('Editor not found in _editorToSourceLine map');
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
let shift = this._editorToSourceLine.get(editor);
|
|
191
|
+
return Object.assign(Object.assign({}, position), { line: position.line + shift });
|
|
192
|
+
}
|
|
193
|
+
virtualPositionAtDocument(sourcePosition) {
|
|
194
|
+
let sourceLine = this.sourceLines.get(sourcePosition.line);
|
|
195
|
+
if (sourceLine == null) {
|
|
196
|
+
throw new PositionError('Source line not mapped to virtual position');
|
|
197
|
+
}
|
|
198
|
+
let virtualLine = sourceLine.virtualLine;
|
|
199
|
+
// position inside the cell (block)
|
|
200
|
+
let sourcePositionCe = {
|
|
201
|
+
line: sourceLine.editorLine,
|
|
202
|
+
column: sourcePosition.ch
|
|
203
|
+
};
|
|
204
|
+
for (let [range, content] of sourceLine.foreignDocumentsMap) {
|
|
205
|
+
const { virtualLine, virtualDocument: document } = content;
|
|
206
|
+
if (isWithinRange(sourcePositionCe, range)) {
|
|
207
|
+
// position inside the foreign document block
|
|
208
|
+
let sourcePositionCm = {
|
|
209
|
+
line: sourcePositionCe.line - range.start.line,
|
|
210
|
+
ch: sourcePositionCe.column - range.start.column
|
|
211
|
+
};
|
|
212
|
+
if (document.isWithinForeign(sourcePositionCm)) {
|
|
213
|
+
return this.virtualPositionAtDocument(sourcePositionCm);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
// where in this block in the entire foreign document?
|
|
217
|
+
sourcePositionCm.line += virtualLine;
|
|
218
|
+
return sourcePositionCm;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
ch: sourcePosition.ch,
|
|
224
|
+
line: virtualLine
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
appendCodeBlock(block, editorShift = { line: 0, column: 0 }, virtualShift) {
|
|
228
|
+
let cellCode = block.value;
|
|
229
|
+
let ceEditor = block.ceEditor;
|
|
230
|
+
if (this.isDisposed) {
|
|
231
|
+
console.warn('Cannot append code block: document disposed');
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
let sourceCellLines = cellCode.split('\n');
|
|
235
|
+
let { lines, foreignDocumentsMap } = this.prepareCodeBlock(block, editorShift);
|
|
236
|
+
for (let i = 0; i < lines.length; i++) {
|
|
237
|
+
this.virtualLines.set(this.lastVirtualLine + i, {
|
|
238
|
+
skipInspect: [],
|
|
239
|
+
editor: ceEditor,
|
|
240
|
+
// TODO this is incorrect, wont work if something was extracted
|
|
241
|
+
sourceLine: this.lastSourceLine + i
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
for (let i = 0; i < sourceCellLines.length; i++) {
|
|
245
|
+
this.sourceLines.set(this.lastSourceLine + i, {
|
|
246
|
+
editorLine: i,
|
|
247
|
+
editorShift: {
|
|
248
|
+
line: editorShift.line - ((virtualShift === null || virtualShift === void 0 ? void 0 : virtualShift.line) || 0),
|
|
249
|
+
column: i === 0 ? editorShift.column - ((virtualShift === null || virtualShift === void 0 ? void 0 : virtualShift.column) || 0) : 0
|
|
250
|
+
},
|
|
251
|
+
// TODO: move those to a new abstraction layer (DocumentBlock class)
|
|
252
|
+
editor: ceEditor,
|
|
253
|
+
foreignDocumentsMap,
|
|
254
|
+
// TODO this is incorrect, wont work if something was extracted
|
|
255
|
+
virtualLine: this.lastVirtualLine + i
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
this.lastVirtualLine += lines.length;
|
|
259
|
+
// one empty line is necessary to separate code blocks, next 'n' lines are to silence linters;
|
|
260
|
+
// the final cell does not get the additional lines (thanks to the use of join, see below)
|
|
261
|
+
this.lineBlocks.push(lines.join('\n') + '\n');
|
|
262
|
+
// adding the virtual lines for the blank lines
|
|
263
|
+
for (let i = 0; i < this.blankLinesBetweenCells; i++) {
|
|
264
|
+
this.virtualLines.set(this.lastVirtualLine + i, {
|
|
265
|
+
skipInspect: [this.idPath],
|
|
266
|
+
editor: ceEditor,
|
|
267
|
+
sourceLine: null
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
this.lastVirtualLine += this.blankLinesBetweenCells;
|
|
271
|
+
this.lastSourceLine += sourceCellLines.length;
|
|
272
|
+
}
|
|
273
|
+
prepareCodeBlock(block, editorShift = { line: 0, column: 0 }) {
|
|
274
|
+
let { cellCodeKept, foreignDocumentsMap } = this.extractForeignCode(block, editorShift);
|
|
275
|
+
let lines = cellCodeKept.split('\n');
|
|
276
|
+
return { lines, foreignDocumentsMap };
|
|
277
|
+
}
|
|
278
|
+
extractForeignCode(block, editorShift) {
|
|
279
|
+
let foreignDocumentsMap = new Map();
|
|
280
|
+
let cellCode = block.value;
|
|
281
|
+
const extractorsForAnyLang = this._foreignCodeExtractors.getExtractors(block.type, null);
|
|
282
|
+
const extractorsForCurrentLang = this._foreignCodeExtractors.getExtractors(block.type, this.language);
|
|
283
|
+
for (let extractor of [
|
|
284
|
+
...extractorsForAnyLang,
|
|
285
|
+
...extractorsForCurrentLang
|
|
286
|
+
]) {
|
|
287
|
+
if (!extractor.hasForeignCode(cellCode, block.type)) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
let results = extractor.extractForeignCode(cellCode);
|
|
291
|
+
let keptCellCode = '';
|
|
292
|
+
for (let result of results) {
|
|
293
|
+
if (result.foreignCode !== null) {
|
|
294
|
+
// result.range should only be null if result.foregin_code is null
|
|
295
|
+
if (result.range === null) {
|
|
296
|
+
console.log('Failure in foreign code extraction: `range` is null but `foreign_code` is not!');
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
let foreignDocument = this.chooseForeignDocument(extractor);
|
|
300
|
+
foreignDocumentsMap.set(result.range, {
|
|
301
|
+
virtualLine: foreignDocument.lastVirtualLine,
|
|
302
|
+
virtualDocument: foreignDocument,
|
|
303
|
+
editor: block.ceEditor
|
|
304
|
+
});
|
|
305
|
+
let foreignShift = {
|
|
306
|
+
line: editorShift.line + result.range.start.line,
|
|
307
|
+
column: editorShift.column + result.range.start.column
|
|
308
|
+
};
|
|
309
|
+
foreignDocument.appendCodeBlock({
|
|
310
|
+
value: result.foreignCode,
|
|
311
|
+
ceEditor: block.ceEditor,
|
|
312
|
+
type: 'code'
|
|
313
|
+
}, foreignShift, result.virtualShift);
|
|
314
|
+
}
|
|
315
|
+
if (result.hostCode != null) {
|
|
316
|
+
keptCellCode += result.hostCode;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
// not breaking - many extractors are allowed to process the code, one after each other
|
|
320
|
+
// (think JS and CSS in HTML, or %R inside of %%timeit).
|
|
321
|
+
cellCode = keptCellCode;
|
|
322
|
+
}
|
|
323
|
+
return { cellCodeKept: cellCode, foreignDocumentsMap };
|
|
324
|
+
}
|
|
325
|
+
chooseForeignDocument(extractor) {
|
|
326
|
+
let foreignDocument;
|
|
327
|
+
// if not standalone, try to append to existing document
|
|
328
|
+
let foreignExists = this.foreignDocuments.has(extractor.language);
|
|
329
|
+
if (!extractor.standalone && foreignExists) {
|
|
330
|
+
foreignDocument = this.foreignDocuments.get(extractor.language);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
// if (previous document does not exists) or (extractor produces standalone documents
|
|
334
|
+
// and no old standalone document could be reused): create a new document
|
|
335
|
+
foreignDocument = this.openForeign(extractor.language, extractor.standalone, extractor.fileExtension);
|
|
336
|
+
}
|
|
337
|
+
return foreignDocument;
|
|
338
|
+
}
|
|
339
|
+
openForeign(language, standalone, fileExtension) {
|
|
340
|
+
let document = new VirtualDocument(Object.assign(Object.assign({}, this.options), { parent: this, standalone: standalone, fileExtension: fileExtension, language: language }));
|
|
341
|
+
const context = {
|
|
342
|
+
foreignDocument: document,
|
|
343
|
+
parentHost: this
|
|
344
|
+
};
|
|
345
|
+
this.foreignDocumentOpened.emit(context);
|
|
346
|
+
// pass through any future signals
|
|
347
|
+
document.foreignDocumentClosed.connect(this.forwardClosedSignal, this);
|
|
348
|
+
document.foreignDocumentOpened.connect(this.forwardOpenedSignal, this);
|
|
349
|
+
this.foreignDocuments.set(document.virtualId, document);
|
|
350
|
+
return document;
|
|
351
|
+
}
|
|
352
|
+
forwardClosedSignal(host, context) {
|
|
353
|
+
this.foreignDocumentClosed.emit(context);
|
|
354
|
+
}
|
|
355
|
+
forwardOpenedSignal(host, context) {
|
|
356
|
+
this.foreignDocumentOpened.emit(context);
|
|
357
|
+
}
|
|
358
|
+
closeForeign(document) {
|
|
359
|
+
this.foreignDocumentClosed.emit({
|
|
360
|
+
foreignDocument: document,
|
|
361
|
+
parentHost: this
|
|
362
|
+
});
|
|
363
|
+
// remove it from foreign documents list
|
|
364
|
+
this.foreignDocuments.delete(document.virtualId);
|
|
365
|
+
// and delete the documents within it
|
|
366
|
+
document.closeAllForeignDocuments();
|
|
367
|
+
document.foreignDocumentClosed.disconnect(this.forwardClosedSignal, this);
|
|
368
|
+
document.foreignDocumentOpened.disconnect(this.forwardOpenedSignal, this);
|
|
369
|
+
document.dispose();
|
|
370
|
+
}
|
|
371
|
+
closeAllForeignDocuments() {
|
|
372
|
+
for (let document of this.foreignDocuments.values()) {
|
|
373
|
+
this.closeForeign(document);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
get value() {
|
|
377
|
+
let linesPadding = '\n'.repeat(this.blankLinesBetweenCells);
|
|
378
|
+
return this.lineBlocks.join(linesPadding);
|
|
379
|
+
}
|
|
380
|
+
get lastLine() {
|
|
381
|
+
const linesInLastBlock = this.lineBlocks[this.lineBlocks.length - 1].split('\n');
|
|
382
|
+
return linesInLastBlock[linesInLastBlock.length - 1];
|
|
383
|
+
}
|
|
384
|
+
closeExpiredDocuments() {
|
|
385
|
+
for (let document of this.unusedDocuments.values()) {
|
|
386
|
+
document.remainingLifetime -= 1;
|
|
387
|
+
if (document.remainingLifetime <= 0) {
|
|
388
|
+
/** TODO */
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
get virtualId() {
|
|
393
|
+
// for easier debugging, the language information is included in the ID:
|
|
394
|
+
return this.standalone
|
|
395
|
+
? this.instanceId + '(' + this.language + ')'
|
|
396
|
+
: this.language;
|
|
397
|
+
}
|
|
398
|
+
get ancestry() {
|
|
399
|
+
if (!this.parent) {
|
|
400
|
+
return [this];
|
|
401
|
+
}
|
|
402
|
+
return this.parent.ancestry.concat([this]);
|
|
403
|
+
}
|
|
404
|
+
get idPath() {
|
|
405
|
+
if (!this.parent) {
|
|
406
|
+
return this.virtualId;
|
|
407
|
+
}
|
|
408
|
+
return this.parent.idPath + '-' + this.virtualId;
|
|
409
|
+
}
|
|
410
|
+
get uri() {
|
|
411
|
+
const encodedPath = encodeURI(this.path);
|
|
412
|
+
if (!this.parent) {
|
|
413
|
+
return encodedPath;
|
|
414
|
+
}
|
|
415
|
+
return encodedPath + '.' + this.idPath + '.' + this.fileExtension;
|
|
416
|
+
}
|
|
417
|
+
transformSourceToEditor(pos) {
|
|
418
|
+
let sourceLine = this.sourceLines.get(pos.line);
|
|
419
|
+
let editorLine = sourceLine.editorLine;
|
|
420
|
+
let editorShift = sourceLine.editorShift;
|
|
421
|
+
return {
|
|
422
|
+
// only shift column in the line beginning the virtual document (first list of the editor in cell magics, but might be any line of editor in line magics!)
|
|
423
|
+
ch: pos.ch + (editorLine === 0 ? editorShift.column : 0),
|
|
424
|
+
line: editorLine + editorShift.line
|
|
425
|
+
// TODO or:
|
|
426
|
+
// line: pos.line + editor_shift.line - this.first_line_of_the_block(editor)
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
Can be null because some lines are added as padding/anchors
|
|
431
|
+
to the virtual document and those do not exist in the source document
|
|
432
|
+
and thus they are absent in the editor.
|
|
433
|
+
*/
|
|
434
|
+
transformVirtualToEditor(virtualPosition) {
|
|
435
|
+
let sourcePosition = this.transformVirtualToSource(virtualPosition);
|
|
436
|
+
if (sourcePosition == null) {
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
return this.transformSourceToEditor(sourcePosition);
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
Can be null because some lines are added as padding/anchors
|
|
443
|
+
to the virtual document and those do not exist in the source document.
|
|
444
|
+
*/
|
|
445
|
+
transformVirtualToSource(position) {
|
|
446
|
+
const line = this.virtualLines.get(position.line).sourceLine;
|
|
447
|
+
if (line == null) {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
return {
|
|
451
|
+
ch: position.ch,
|
|
452
|
+
line: line
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
get root() {
|
|
456
|
+
if (this.parent == null) {
|
|
457
|
+
return this;
|
|
458
|
+
}
|
|
459
|
+
return this.parent.root;
|
|
460
|
+
}
|
|
461
|
+
getEditorAtVirtualLine(pos) {
|
|
462
|
+
let line = pos.line;
|
|
463
|
+
// tolerate overshot by one (the hanging blank line at the end)
|
|
464
|
+
if (!this.virtualLines.has(line)) {
|
|
465
|
+
line -= 1;
|
|
466
|
+
}
|
|
467
|
+
return this.virtualLines.get(line).editor;
|
|
468
|
+
}
|
|
469
|
+
getEditorAtSourceLine(pos) {
|
|
470
|
+
return this.sourceLines.get(pos.line).editor;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Recursively emits changed signal from the document or any descendant foreign document.
|
|
474
|
+
*/
|
|
475
|
+
maybeEmitChanged() {
|
|
476
|
+
if (this.value !== this.previousValue) {
|
|
477
|
+
this.changed.emit(this);
|
|
478
|
+
}
|
|
479
|
+
this.previousValue = this.value;
|
|
480
|
+
for (let document of this.foreignDocuments.values()) {
|
|
481
|
+
document.maybeEmitChanged();
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
static ceToCm(position) {
|
|
485
|
+
return { line: position.line, ch: position.column };
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
VirtualDocument.instancesCount = 0;
|
|
489
|
+
export function collectDocuments(virtualDocument) {
|
|
490
|
+
let collected = new Set();
|
|
491
|
+
collected.add(virtualDocument);
|
|
492
|
+
for (let foreign of virtualDocument.foreignDocuments.values()) {
|
|
493
|
+
let foreignLanguages = collectDocuments(foreign);
|
|
494
|
+
foreignLanguages.forEach(collected.add, collected);
|
|
495
|
+
}
|
|
496
|
+
return collected;
|
|
497
|
+
}
|
|
498
|
+
export class UpdateManager {
|
|
499
|
+
constructor(virtualDocument) {
|
|
500
|
+
this.virtualDocument = virtualDocument;
|
|
501
|
+
/**
|
|
502
|
+
* Virtual documents update guard.
|
|
503
|
+
*/
|
|
504
|
+
this.isUpdateInProgress = false;
|
|
505
|
+
this.updateLock = false;
|
|
506
|
+
this.isDisposed = false;
|
|
507
|
+
this.updateDone = new Promise(resolve => {
|
|
508
|
+
resolve();
|
|
509
|
+
});
|
|
510
|
+
this.documentUpdated = new Signal(this);
|
|
511
|
+
this.blockAdded = new Signal(this);
|
|
512
|
+
this.updateBegan = new Signal(this);
|
|
513
|
+
this.updateFinished = new Signal(this);
|
|
514
|
+
this.documentUpdated.connect(this.onUpdated, this);
|
|
515
|
+
}
|
|
516
|
+
dispose() {
|
|
517
|
+
if (this.isDisposed) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
this.documentUpdated.disconnect(this.onUpdated, this);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Once all the foreign documents were refreshed, the unused documents (and their connections)
|
|
524
|
+
* should be terminated if their lifetime has expired.
|
|
525
|
+
*/
|
|
526
|
+
onUpdated(manager, rootDocument) {
|
|
527
|
+
try {
|
|
528
|
+
rootDocument.closeExpiredDocuments();
|
|
529
|
+
}
|
|
530
|
+
catch (e) {
|
|
531
|
+
console.warn('Failed to close expired documents');
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
canUpdate() {
|
|
535
|
+
return !this.isDisposed && !this.isUpdateInProgress && !this.updateLock;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Execute provided callback within an update-locked context, which guarantees that:
|
|
539
|
+
* - the previous updates must have finished before the callback call, and
|
|
540
|
+
* - no update will happen when executing the callback
|
|
541
|
+
* @param fn - the callback to execute in update lock
|
|
542
|
+
*/
|
|
543
|
+
async withUpdateLock(fn) {
|
|
544
|
+
await untilReady(() => this.canUpdate(), 12, 10).then(() => {
|
|
545
|
+
try {
|
|
546
|
+
this.updateLock = true;
|
|
547
|
+
fn();
|
|
548
|
+
}
|
|
549
|
+
finally {
|
|
550
|
+
this.updateLock = false;
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Update all the virtual documents, emit documents updated with root document if succeeded,
|
|
556
|
+
* and resolve a void promise. The promise does not contain the text value of the root document,
|
|
557
|
+
* as to avoid an easy trap of ignoring the changes in the virtual documents.
|
|
558
|
+
*/
|
|
559
|
+
async updateDocuments(blocks) {
|
|
560
|
+
let update = new Promise((resolve, reject) => {
|
|
561
|
+
// defer the update by up to 50 ms (10 retrials * 5 ms break),
|
|
562
|
+
// awaiting for the previous update to complete.
|
|
563
|
+
untilReady(() => this.canUpdate(), 10, 5)
|
|
564
|
+
.then(() => {
|
|
565
|
+
if (this.isDisposed || !this.virtualDocument) {
|
|
566
|
+
resolve();
|
|
567
|
+
}
|
|
568
|
+
try {
|
|
569
|
+
this.isUpdateInProgress = true;
|
|
570
|
+
this.updateBegan.emit(blocks);
|
|
571
|
+
this.virtualDocument.clear();
|
|
572
|
+
for (let codeBlock of blocks) {
|
|
573
|
+
this.blockAdded.emit({
|
|
574
|
+
block: codeBlock,
|
|
575
|
+
virtualDocument: this.virtualDocument
|
|
576
|
+
});
|
|
577
|
+
this.virtualDocument.appendCodeBlock(codeBlock);
|
|
578
|
+
}
|
|
579
|
+
this.updateFinished.emit(blocks);
|
|
580
|
+
if (this.virtualDocument) {
|
|
581
|
+
this.documentUpdated.emit(this.virtualDocument);
|
|
582
|
+
this.virtualDocument.maybeEmitChanged();
|
|
583
|
+
}
|
|
584
|
+
resolve();
|
|
585
|
+
}
|
|
586
|
+
catch (e) {
|
|
587
|
+
console.warn('Documents update failed:', e);
|
|
588
|
+
reject(e);
|
|
589
|
+
}
|
|
590
|
+
finally {
|
|
591
|
+
this.isUpdateInProgress = false;
|
|
592
|
+
}
|
|
593
|
+
})
|
|
594
|
+
.catch(console.error);
|
|
595
|
+
});
|
|
596
|
+
this.updateDone = update;
|
|
597
|
+
return update;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
//# sourceMappingURL=document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/virtual/document.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGlE,OAAO,EAKL,aAAa,EACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAqDlD;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA8B,EAC9B,KAAwB;IAExB,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;QACvC,OAAO,CACL,QAAQ,CAAC,IAAI,KAAK,KAAK,CAAC,KAAK,CAAC,IAAI;YAClC,QAAQ,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM;YACrC,QAAQ,CAAC,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CACpC,CAAC;KACH;IAED,OAAO,CACL,CAAC,QAAQ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