1
0
Fork 0

Stop traversal upon finding the node

pull/305/head
Matthew Brown 2017-02-17 16:07:44 -05:00 committed by GitHub
parent 5f1bc35195
commit 8a4c83c272
1 changed files with 2 additions and 1 deletions

View File

@ -3,7 +3,7 @@ declare(strict_types = 1);
namespace LanguageServer\NodeVisitor; namespace LanguageServer\NodeVisitor;
use PhpParser\{NodeVisitorAbstract, Node}; use PhpParser\{NodeVisitorAbstract, Node, NodeTraverser};
use LanguageServer\Protocol\{Position, Range}; use LanguageServer\Protocol\{Position, Range};
/** /**
@ -38,6 +38,7 @@ class NodeAtPositionFinder extends NodeVisitorAbstract
$range = Range::fromNode($node); $range = Range::fromNode($node);
if ($range->includes($this->position)) { if ($range->includes($this->position)) {
$this->node = $node; $this->node = $node;
return NodeTraverser::STOP_TRAVERSAL
} }
} }
} }