Fix text document loader bug.
parent
e0446abd86
commit
f87dbb9518
|
@ -19,7 +19,7 @@ class PhpDocumentLoader
|
|||
*
|
||||
* @var PhpDocument
|
||||
*/
|
||||
private $documents = [];
|
||||
public $documents = [];
|
||||
|
||||
/**
|
||||
* @var ContentRetriever
|
||||
|
|
|
@ -265,7 +265,15 @@ class TextDocument
|
|||
public function definition(TextDocumentIdentifier $textDocument, Position $position): Promise
|
||||
{
|
||||
return coroutine(function () use ($textDocument, $position) {
|
||||
$document = yield $this->documentLoader->getOrLoad($textDocument->uri);
|
||||
$documentLoader = $this->documentLoader;//->getOrLoad($textDocument->uri);
|
||||
$document = null;
|
||||
if (isset($documentLoader->documents[$textDocument->uri])) {
|
||||
$document = $documentLoader->documents[$textDocument->uri];
|
||||
} else {
|
||||
$document = yield $documentLoader->load($textDocument->uri);
|
||||
$documentLoader->documents[$textDocument->uri] = $document;
|
||||
}
|
||||
|
||||
$node = $document->getNodeAtPosition($position);
|
||||
if ($node === null) {
|
||||
return [];
|
||||
|
|
Loading…
Reference in New Issue