MCPcopy
hub / github.com/witheve/Eve / attachView

Method attachView

src/ide.ts:2860–2891  ·  view source on GitHub ↗
(recordId:string, spanId:string)

Source from the content-addressed store, hash-verified

2858 }
2859
2860 attachView(recordId:string, spanId:string) {
2861 let view = this.activeViews[recordId];
2862
2863 // @NOTE: This isn't particularly kosher.
2864 let node = activeElements[recordId];
2865 if(!node) return;
2866 if(node !== view.container.firstChild) {
2867 view.container.appendChild(node);
2868 }
2869
2870 let sourceSpan:Span|undefined = view.span;
2871 if(spanId !== undefined) {
2872 sourceSpan = this.editor.getSpanBySourceId(spanId);
2873 }
2874
2875 if(!sourceSpan) return;
2876 view.span = sourceSpan;
2877
2878 let loc = sourceSpan.find();
2879 if(!loc) return;
2880 let line = loc.to.line;
2881 if(sourceSpan.isBlock()) line -= 1;
2882
2883 if(view.widget && line === view.line) return;
2884
2885 if(view.widget) {
2886 view.widget.clear();
2887 }
2888
2889 view.line = line;
2890 view.widget = this.editor.cm.addLineWidget(line, view.container);
2891 }
2892
2893 //-------------------------------------------------------
2894 // Inspector

Callers 2

updateViewsMethod · 0.95
_findNodeMethod · 0.80

Calls 5

getSpanBySourceIdMethod · 0.80
isBlockMethod · 0.80
addLineWidgetMethod · 0.80
findMethod · 0.65
clearMethod · 0.65

Tested by

no test coverage detected