Stop traversal upon finding the node
parent
5f1bc35195
commit
8a4c83c272
|
@ -3,7 +3,7 @@ declare(strict_types = 1);
|
|||
|
||||
namespace LanguageServer\NodeVisitor;
|
||||
|
||||
use PhpParser\{NodeVisitorAbstract, Node};
|
||||
use PhpParser\{NodeVisitorAbstract, Node, NodeTraverser};
|
||||
use LanguageServer\Protocol\{Position, Range};
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,7 @@ class NodeAtPositionFinder extends NodeVisitorAbstract
|
|||
$range = Range::fromNode($node);
|
||||
if ($range->includes($this->position)) {
|
||||
$this->node = $node;
|
||||
return NodeTraverser::STOP_TRAVERSAL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue