File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -468,19 +468,27 @@ end
468468function m .getLocal (source , name , pos )
469469 local block = source
470470 -- find nearest source
471- while block .start > pos or block .finish < pos do
472- block = block .parent
471+ for _ = 1 , 10000 do
473472 if not block then
474473 return nil
475474 end
475+ if block .start <= pos and block .finish >= pos then
476+ break
477+ end
478+ block = block .parent
476479 end
480+
477481 m .eachSourceContain (block , pos , function (src )
478482 if blockTypes [src .type ]
479483 and (src .finish - src .start ) < (block .finish - src .start ) then
480484 block = src
481485 end
482486 end )
483- while block do
487+
488+ for _ = 1 , 10000 do
489+ if not block then
490+ break
491+ end
484492 local res
485493 if block .locals then
486494 for _ , loc in ipairs (block .locals ) do
You can’t perform that action at this time.
0 commit comments