Number of blank lines appended to the virtual document between each cell.
the remote document uri, version and other server-related info
ReadonlyfileFile extension of the document.
ReadonlyforeignMap holding the children VirtualDocument .
ReadonlyhasNotebooks or any other aggregates of documents are not supported by the LSP specification, and we need to make appropriate adjustments for them, pretending they are simple files so that the LSP servers do not refuse to cooperate.
ReadonlyinstanceUnique id of the virtual document.
ReadonlylanguageThe language identifier of the document.
Line number of the last line in the real document.
Line number of the last line in the virtual document.
ProtectedlineOptionalparentParent of the current virtual document.
ReadonlypathPath to the document.
ProtectedsourceReadonlystandaloneBeing standalone is relevant to foreign documents and defines whether following chunks of code in the same language should be appended to this document (false, not standalone) or should be considered separate documents (true, standalone)
ProtectedunusedReadonlyupdateThe update manager object.
ProtectedvirtualVirtual lines keep all the lines present in the document AND extracted to the foreign document.
Return the ancestry to this document.
Signal emitted when the foreign document is changed
Signal emitted when the foreign document is closed
Signal emitted when the foreign document is opened
Return the id path to the virtual document.
Test whether the document is disposed.
Get the last line in the virtual document
ProtectedremainingWhen this counter goes down to 0, the document will be destroyed and the associated connection will be closed; This is meant to reduce the number of open connections when a foreign code snippet was removed from the document.
Note: top level virtual documents are currently immortal (unless killed by other means); it might be worth implementing culling of unused documents, but if and only if JupyterLab will also implement culling of idle kernels - otherwise the user experience could be a bit inconsistent, and we would need to invent our own rules.
Get the root document of current virtual document.
Get the uri of the virtual document.
Get the text value of the document
Id of the virtual document.
Append a code block to the end of the virtual document.
block to be appended
position shift in source document
OptionalvirtualShift: CodeEditor.IPositionposition shift in virtual document.
Close a foreign document and disconnect all associated signals
Get the virtual document from the cursor position of the source document
position in source document
Extract the foreign code from input block by using the registered extractors.
block to be appended
position shift in source document
Get the corresponding editor of the source line
Get the corresponding editor of the virtual line.
Detect if the input source position is belong to the current virtual document.
position in the source document
Extract a code block into list of string in supported language and a map of foreign document if any.
block to be appended
position shift in source document
Compute the position in root document from the position of a child editor.
the active editor.
position in the active editor.
Transform the position of the source to the editor position.
position in the source document
position in the editor.
Transform the position in the virtual document to the editor position. Can be null because some lines are added as padding/anchors to the virtual document and those do not exist in the source document and thus they are absent in the editor.
Compute the position in root document from the position of a virtual document.
Transform the position in the virtual document to the source. Can be null because some lines are added as padding/anchors to the virtual document and those do not exist in the source document.
Compute the position in the virtual document from the position if the source document.
position in source document
StaticceConvert from code editor position into code mirror position.
A notebook can hold one or more virtual documents; there is always one, "root" document, corresponding to the language of the kernel. All other virtual documents are extracted out of the notebook, based on magics, or other syntax constructs, depending on the kernel language.
Virtual documents represent the underlying code in a single language, which has been parsed excluding interactive kernel commands (magics) which could be misunderstood by the specific LSP server.
VirtualDocument has no awareness of the notebook or editor it lives in, however it is able to transform its content back to the notebook space, as it keeps editor coordinates for each virtual line.
The notebook/editor aware transformations are preferred to be placed in VirtualEditor descendants rather than here.
No dependency on editor implementation (such as CodeMirrorEditor) is allowed for VirtualEditor.