@@ -7,7 +7,6 @@ import { IOverridesRegistry } from '../magics/overrides';
7
7
import { DefaultMap , until_ready } from '../utils' ;
8
8
import { Signal } from '@lumino/signaling' ;
9
9
import { CodeEditor } from '@jupyterlab/codeeditor' ;
10
- import * as CodeMirror from 'codemirror' ;
11
10
import {
12
11
IEditorPosition ,
13
12
ISourcePosition ,
@@ -41,6 +40,8 @@ export interface IVirtualDocumentBlock {
41
40
virtual_document : VirtualDocument ;
42
41
}
43
42
43
+ export type ForeignDocumentsMap = Map < IRange , IVirtualDocumentBlock > ;
44
+
44
45
interface ISourceLine {
45
46
virtual_line : number ;
46
47
editor : CodeEditor . IEditor ;
@@ -50,7 +51,7 @@ interface ISourceLine {
50
51
/**
51
52
* Everything which is not in the range of foreign documents belongs to the host.
52
53
*/
53
- foreign_documents_map : Map < IRange , IVirtualDocumentBlock > ;
54
+ foreign_documents_map : ForeignDocumentsMap ;
54
55
}
55
56
56
57
export interface IForeignContext {
@@ -580,6 +581,14 @@ export class VirtualDocument {
580
581
return { lines, foreign_document_map, skip_inspect } ;
581
582
}
582
583
584
+ get foreign_document_maps ( ) : ForeignDocumentsMap [ ] {
585
+ let maps = new Set < ForeignDocumentsMap > ( ) ;
586
+ for ( let line of this . source_lines . values ( ) ) {
587
+ maps . add ( line . foreign_documents_map ) ;
588
+ }
589
+ return [ ...maps . values ( ) ] ;
590
+ }
591
+
583
592
append_code_block (
584
593
cell_code : string ,
585
594
ce_editor : CodeEditor . IEditor ,
@@ -753,7 +762,7 @@ export class VirtualDocument {
753
762
return this . virtual_lines . get ( line ) . editor ;
754
763
}
755
764
756
- get_editor_at_source_line ( pos : CodeMirror . Position ) : CodeEditor . IEditor {
765
+ get_editor_at_source_line ( pos : ISourcePosition ) : CodeEditor . IEditor {
757
766
return this . source_lines . get ( pos . line ) . editor ;
758
767
}
759
768
0 commit comments