MCPcopy Index your code
hub / github.com/SplootCode/splootcode / getWrapInsertChildSet

Method getWrapInsertChildSet

packages/core/src/language/node.ts:85–107  ·  view source on GitHub ↗
(childNode: SplootNode)

Source from the content-addressed store, hash-verified

83 }
84
85 getWrapInsertChildSet(childNode: SplootNode): ChildSet {
86 const order = this.childSetWrapPriorityOrder ? this.childSetWrapPriorityOrder : this.childSetOrder
87 for (const childSetID of order) {
88 const childSet = this.getChildSet(childSetID)
89 if (childSet.getCount() === 0) {
90 if (isAdaptableToPasteDesintation(childNode, childSet.nodeCategory)) {
91 return childSet
92 }
93 } else {
94 const firstChild = childSet.getChild(0)
95 if (firstChild.isEmpty()) {
96 if (isAdaptableToPasteDesintation(childNode, childSet.nodeCategory)) {
97 return childSet
98 }
99 const childResult = firstChild.getWrapInsertChildSet(childNode)
100 if (childResult) {
101 return childResult
102 }
103 }
104 }
105 }
106 return null
107 }
108
109 handleScopeMutation(mutation: ScopeMutation) {
110 // No-op default implementation.

Callers 1

wrapNodeOnPasteMethod · 0.80

Calls 5

getChildSetMethod · 0.95
getCountMethod · 0.80
getChildMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected