Use phpstubs:// URI scheme for stubs
parent
6f494d1db9
commit
2e0b511e0e
|
@ -7,11 +7,13 @@ use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
|||
use LanguageServer\Index\StubsIndex;
|
||||
use phpDocumentor\Reflection\DocBlockFactory;
|
||||
use Webmozart\PathUtil\Path;
|
||||
use Sabre\Uri;
|
||||
use function Sabre\Event\coroutine;
|
||||
|
||||
require_once __DIR__ . '/../vendor/sabre/event/lib/coroutine.php';
|
||||
require_once __DIR__ . '/../vendor/sabre/event/lib/Loop/functions.php';
|
||||
require_once __DIR__ . '/../vendor/sabre/event/lib/Promise/functions.php';
|
||||
require_once __DIR__ . '/../vendor/sabre/uri/lib/functions.php';
|
||||
require_once __DIR__ . '/utils.php';
|
||||
|
||||
class ComposerScripts
|
||||
|
@ -28,11 +30,19 @@ class ComposerScripts
|
|||
$parser = new Parser;
|
||||
$definitionResolver = new DefinitionResolver($index);
|
||||
|
||||
$uris = yield $finder->find(Path::canonicalize(__DIR__ . '/../vendor/JetBrains/phpstorm-stubs/**/*.php'));
|
||||
$stubsLocation = Path::canonicalize(__DIR__ . '/../vendor/JetBrains/phpstorm-stubs');
|
||||
$uris = yield $finder->find("$stubsLocation/**/*.php");
|
||||
|
||||
foreach ($uris as $uri) {
|
||||
echo "Parsing $uri\n";
|
||||
$content = yield $contentRetriever->retrieve($uri);
|
||||
|
||||
// Change URI to phpstubs://
|
||||
$parts = Uri\parse($uri);
|
||||
$parts['path'] = Path::makeRelative($parts['path'], $stubsLocation);
|
||||
$parts['scheme'] = 'phpstubs';
|
||||
$uri = Uri\build($parts);
|
||||
|
||||
$document = new PhpDocument($uri, $content, $index, $parser, $docBlockFactory, $definitionResolver);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue