2016-12-13 00:51:02 +00:00
|
|
|
<?php
|
|
|
|
declare(strict_types = 1);
|
|
|
|
|
|
|
|
namespace LanguageServer\Index;
|
|
|
|
|
|
|
|
use LanguageServer\Definition;
|
2017-01-25 00:38:11 +00:00
|
|
|
use Sabre\Event\EmitterInterface;
|
2016-12-13 00:51:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The ReadableIndex interface provides methods to lookup definitions and references
|
2017-01-25 00:38:11 +00:00
|
|
|
*
|
|
|
|
* @event definition-added Emitted when a definition was added
|
|
|
|
* @event static-complete Emitted when definitions and static references are complete
|
|
|
|
* @event complete Emitted when the index is complete
|
2016-12-13 00:51:02 +00:00
|
|
|
*/
|
2017-01-25 00:38:11 +00:00
|
|
|
interface ReadableIndex extends EmitterInterface
|
2016-12-13 00:51:02 +00:00
|
|
|
{
|
2017-01-25 00:38:11 +00:00
|
|
|
/**
|
|
|
|
* Returns true if this index is complete
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isComplete(): bool;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if definitions and static references are complete
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function isStaticComplete(): bool;
|
|
|
|
|
2016-12-13 00:51:02 +00:00
|
|
|
/**
|
2017-08-09 20:10:13 +00:00
|
|
|
* Returns a Generator providing an associative array [string => Definition]
|
|
|
|
* that maps fully qualified symbol names to Definitions (global or not)
|
2016-12-13 00:51:02 +00:00
|
|
|
*
|
2017-08-09 20:10:13 +00:00
|
|
|
* @return \Generator providing Definition[]
|
2016-12-13 00:51:02 +00:00
|
|
|
*/
|
2017-08-09 20:10:13 +00:00
|
|
|
public function getDefinitions(): \Generator;
|
2016-12-13 00:51:02 +00:00
|
|
|
|
2017-08-06 21:05:32 +00:00
|
|
|
/**
|
2017-08-09 20:51:42 +00:00
|
|
|
* Returns a Generator providing an associative array [string => Definition]
|
|
|
|
* that maps fully qualified symbol names to global Definitions
|
2017-08-06 21:05:32 +00:00
|
|
|
*
|
2017-08-09 20:51:42 +00:00
|
|
|
* @return \Generator providing Definitions[]
|
2017-08-06 21:05:32 +00:00
|
|
|
*/
|
2017-08-09 20:51:42 +00:00
|
|
|
public function getGlobalDefinitions(): \Generator;
|
2017-08-06 21:05:32 +00:00
|
|
|
|
2017-08-06 14:48:41 +00:00
|
|
|
/**
|
2017-10-05 18:45:57 +00:00
|
|
|
* Returns a Generator providing the Definitions that are in the given FQN
|
2017-08-06 14:48:41 +00:00
|
|
|
*
|
2017-10-05 18:45:57 +00:00
|
|
|
* @param string $fqn
|
2017-08-09 20:51:42 +00:00
|
|
|
* @return \Generator providing Definitions[]
|
2017-08-06 14:48:41 +00:00
|
|
|
*/
|
2017-10-05 18:45:57 +00:00
|
|
|
public function getDefinitionsForFqn(string $fqn): \Generator;
|
2017-08-06 14:48:41 +00:00
|
|
|
|
2016-12-13 00:51:02 +00:00
|
|
|
/**
|
|
|
|
* Returns the Definition object by a specific FQN
|
|
|
|
*
|
|
|
|
* @param string $fqn
|
|
|
|
* @param bool $globalFallback Whether to fallback to global if the namespaced FQN was not found
|
|
|
|
* @return Definition|null
|
|
|
|
*/
|
|
|
|
public function getDefinition(string $fqn, bool $globalFallback = false);
|
|
|
|
|
|
|
|
/**
|
2017-08-09 22:06:53 +00:00
|
|
|
* Returns a Generator providing all URIs in this index that reference a symbol
|
2016-12-13 00:51:02 +00:00
|
|
|
*
|
|
|
|
* @param string $fqn The fully qualified name of the symbol
|
2017-08-09 22:06:53 +00:00
|
|
|
* @return \Generator providing string[]
|
2016-12-13 00:51:02 +00:00
|
|
|
*/
|
2017-08-09 22:06:53 +00:00
|
|
|
public function getReferenceUris(string $fqn): \Generator;
|
2016-12-13 00:51:02 +00:00
|
|
|
}
|