File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -293,7 +293,22 @@ function utils.get_node_text(node, content)
293
293
if end_col == 0 then
294
294
end_line = end_row
295
295
end
296
- local lines = { unpack (content , start_line , end_line ) }
296
+ local range = end_line - start_line + 1
297
+ local lines = {}
298
+ if range < 5000 then
299
+ lines = { unpack (content , start_line , end_line ) }
300
+ else
301
+ local chunks = math.floor (range / 5000 )
302
+ local leftover = range % 5000
303
+ for i = 1 , chunks do
304
+ lines = utils .concat (lines , { unpack (content , (i - 1 ) * 5000 + 1 , i * 5000 ) })
305
+ end
306
+ if leftover > 0 then
307
+ local s = chunks * 5000
308
+ lines = utils .concat (lines , { unpack (content , s + 1 , s + leftover ) })
309
+ end
310
+ end
311
+
297
312
lines [1 ] = string.sub (lines [1 ], start_col + 1 )
298
313
if end_col > 0 then
299
314
lines [# lines ] = string.sub (lines [# lines ], 1 , end_col )
You can’t perform that action at this time.
0 commit comments