@@ -155,7 +155,8 @@ local function store_cursor_node_relative(node)
155155
156156 store_id = store_id + 1
157157
158- snip_data .cursor_end_relative = util .pos_sub (util .get_cursor_0ind (), node .mark :get_endpoint (1 ))
158+ snip_data .cursor_end_relative =
159+ util .pos_sub (util .get_cursor_0ind (), node .mark :get_endpoint (1 ))
159160
160161 data [snip ] = snip_data
161162
@@ -167,24 +168,23 @@ end
167168
168169local function get_corresponding_node (parent , data )
169170 return parent :find_node (function (test_node )
170- return (test_node .store_id == data .store_id ) or (data .key ~= nil and test_node .key == data .key )
171+ return (test_node .store_id == data .store_id )
172+ or (data .key ~= nil and test_node .key == data .key )
171173 end )
172174end
173175
174176local function restore_cursor_pos_relative (node , data )
175177 util .set_cursor_0ind (
176- util .pos_add (
177- node .mark :get_endpoint (1 ),
178- data .cursor_end_relative
179- )
178+ util .pos_add (node .mark :get_endpoint (1 ), data .cursor_end_relative )
180179 )
181180end
182181
183182local function node_update_dependents_preserve_position (node , opts )
184183 local restore_data = store_cursor_node_relative (node )
185184
186185 -- update all nodes that depend on this one.
187- local ok , res = pcall (node .update_dependents , node , {own = true , parents = true })
186+ local ok , res =
187+ pcall (node .update_dependents , node , { own = true , parents = true })
188188 if not ok then
189189 local snip = node :get_snippet ()
190190
@@ -194,7 +194,10 @@ local function node_update_dependents_preserve_position(node, opts)
194194 snip .trigger ,
195195 res
196196 )
197- return { jump_done = false , new_node = session .current_nodes [vim .api .nvim_get_current_buf ()] }
197+ return {
198+ jump_done = false ,
199+ new_node = session .current_nodes [vim .api .nvim_get_current_buf ()],
200+ }
198201 end
199202
200203 -- update successful => check if the current node is still visible.
@@ -228,11 +231,17 @@ local function node_update_dependents_preserve_position(node, opts)
228231 -- since the node was no longer visible after an update, it must have
229232 -- been contained in a dynamicNode, and we don't have to handle the
230233 -- case that we can't find it.
231- while node_parent .dynamicNode == nil or node_parent .dynamicNode .visible == false do
234+ while
235+ node_parent .dynamicNode == nil
236+ or node_parent .dynamicNode .visible == false
237+ do
232238 node_parent = node_parent .parent
233239 end
234240 local d = node_parent .dynamicNode
235- assert (d .active , " Visible dynamicNode that was a parent of the current node is not active after the update!! If you get this message, please open an issue with LuaSnip!" )
241+ assert (
242+ d .active ,
243+ " Visible dynamicNode that was a parent of the current node is not active after the update!! If you get this message, please open an issue with LuaSnip!"
244+ )
236245
237246 local new_node = get_corresponding_node (d , snip_restore_data )
238247
@@ -248,7 +257,10 @@ local function node_update_dependents_preserve_position(node, opts)
248257 else
249258 -- could not find corresponding node -> just jump into the
250259 -- dynamicNode that should have generated it.
251- return { jump_done = true , new_node = d :jump_into_snippet (opts .no_move ) }
260+ return {
261+ jump_done = true ,
262+ new_node = d :jump_into_snippet (opts .no_move ),
263+ }
252264 end
253265 end
254266end
@@ -262,7 +274,10 @@ local function safe_jump_current(dir, no_move, dry_run)
262274
263275 -- don't update for -1-node.
264276 if not dry_run and node .pos >= 0 then
265- local upd_res = node_update_dependents_preserve_position (node , { no_move = no_move , restore_position = false })
277+ local upd_res = node_update_dependents_preserve_position (
278+ node ,
279+ { no_move = no_move , restore_position = false }
280+ )
266281 if upd_res .jump_done then
267282 return upd_res .new_node
268283 else
@@ -599,7 +614,10 @@ local function active_update_dependents()
599614 -- don't update if a jump/change_choice is in progress, or if we don't have
600615 -- an active node.
601616 if not session .jump_active and active ~= nil then
602- local upd_res = node_update_dependents_preserve_position (active , { no_move = false , restore_position = true })
617+ local upd_res = node_update_dependents_preserve_position (
618+ active ,
619+ { no_move = false , restore_position = true }
620+ )
603621 session .current_nodes [vim .api .nvim_get_current_buf ()] = upd_res .new_node
604622 end
605623end
0 commit comments