Merge branch 'master' into index
commit
dc3e4a6b81
|
@ -4,12 +4,10 @@ declare(strict_types = 1);
|
||||||
namespace LanguageServer;
|
namespace LanguageServer;
|
||||||
|
|
||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
use phpDocumentor\Reflection\Types;
|
|
||||||
use LanguageServer\Protocol\{
|
use LanguageServer\Protocol\{
|
||||||
TextEdit,
|
TextEdit,
|
||||||
Range,
|
Range,
|
||||||
Position,
|
Position,
|
||||||
SymbolKind,
|
|
||||||
CompletionList,
|
CompletionList,
|
||||||
CompletionItem,
|
CompletionItem,
|
||||||
CompletionItemKind
|
CompletionItemKind
|
||||||
|
@ -134,7 +132,6 @@ class CompletionProvider
|
||||||
|| $node instanceof Node\Expr\StaticPropertyFetch
|
|| $node instanceof Node\Expr\StaticPropertyFetch
|
||||||
|| $node instanceof Node\Expr\ClassConstFetch
|
|| $node instanceof Node\Expr\ClassConstFetch
|
||||||
) {
|
) {
|
||||||
if (!is_string($node->name)) {
|
|
||||||
// If the name is an Error node, just filter by the class
|
// If the name is an Error node, just filter by the class
|
||||||
if ($node instanceof Node\Expr\MethodCall || $node instanceof Node\Expr\PropertyFetch) {
|
if ($node instanceof Node\Expr\MethodCall || $node instanceof Node\Expr\PropertyFetch) {
|
||||||
// For instances, resolve the variable type
|
// For instances, resolve the variable type
|
||||||
|
@ -155,10 +152,6 @@ class CompletionProvider
|
||||||
$prefix .= '::$';
|
$prefix .= '::$';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$fqn = $this->definitionResolver->resolveReferenceNodeToFqn($node);
|
|
||||||
$prefixes = $fqn !== null ? [$fqn] : [];
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->project->getDefinitions() as $fqn => $def) {
|
foreach ($this->project->getDefinitions() as $fqn => $def) {
|
||||||
foreach ($prefixes as $prefix) {
|
foreach ($prefixes as $prefix) {
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace LanguageServer\ContentRetriever;
|
||||||
|
|
||||||
|
use LanguageServer\LanguageClient;
|
||||||
|
use LanguageServer\Protocol\{TextDocumentIdentifier, TextDocumentItem};
|
||||||
|
use Sabre\Event\Promise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves file content from the client through a textDocument/xcontent request
|
||||||
|
*/
|
||||||
|
class ClientContentRetriever implements ContentRetriever
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param LanguageClient $client
|
||||||
|
*/
|
||||||
|
public function __construct(LanguageClient $client)
|
||||||
|
{
|
||||||
|
$this->client = $client;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the content of a text document identified by the URI through a textDocument/xcontent request
|
||||||
|
*
|
||||||
|
* @param string $uri The URI of the document
|
||||||
|
* @return Promise <string> Resolved with the content as a string
|
||||||
|
*/
|
||||||
|
public function retrieve(string $uri): Promise
|
||||||
|
{
|
||||||
|
return $this->client->textDocument->xcontent(new TextDocumentIdentifier($uri))
|
||||||
|
->then(function (TextDocumentItem $textDocument) {
|
||||||
|
return $textDocument->text;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace LanguageServer\ContentRetriever;
|
||||||
|
|
||||||
|
use Sabre\Event\Promise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for retrieving the content of a text document
|
||||||
|
*/
|
||||||
|
interface ContentRetriever
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Retrieves the content of a text document identified by the URI
|
||||||
|
*
|
||||||
|
* @param string $uri The URI of the document
|
||||||
|
* @return Promise <string> Resolved with the content as a string
|
||||||
|
*/
|
||||||
|
public function retrieve(string $uri): Promise;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace LanguageServer\ContentRetriever;
|
||||||
|
|
||||||
|
use Sabre\Event\Promise;
|
||||||
|
use function LanguageServer\uriToPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves document content from the file system
|
||||||
|
*/
|
||||||
|
class FileSystemContentRetriever implements ContentRetriever
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Retrieves the content of a text document identified by the URI from the file system
|
||||||
|
*
|
||||||
|
* @param string $uri The URI of the document
|
||||||
|
* @return Promise <string> Resolved with the content as a string
|
||||||
|
*/
|
||||||
|
public function retrieve(string $uri): Promise
|
||||||
|
{
|
||||||
|
return Promise\resolve(file_get_contents(uriToPath($uri)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace LanguageServer\FilesFinder;
|
||||||
|
|
||||||
|
use LanguageServer\LanguageClient;
|
||||||
|
use Sabre\Event\Promise;
|
||||||
|
use Sabre\Uri;
|
||||||
|
use Webmozart\Glob\Glob;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves file content from the client through a textDocument/xcontent request
|
||||||
|
*/
|
||||||
|
class ClientFilesFinder implements FilesFinder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var LanguageClient
|
||||||
|
*/
|
||||||
|
private $client;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param LanguageClient $client
|
||||||
|
*/
|
||||||
|
public function __construct(LanguageClient $client)
|
||||||
|
{
|
||||||
|
$this->client = $client;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all files in the workspace that match a glob.
|
||||||
|
* If the client does not support workspace/files, it falls back to searching the file system directly.
|
||||||
|
*
|
||||||
|
* @param string $glob
|
||||||
|
* @return Promise <string[]> The URIs
|
||||||
|
*/
|
||||||
|
public function find(string $glob): Promise
|
||||||
|
{
|
||||||
|
return $this->client->workspace->xfiles()->then(function (array $textDocuments) use ($glob) {
|
||||||
|
$uris = [];
|
||||||
|
foreach ($textDocuments as $textDocument) {
|
||||||
|
$path = Uri\parse($textDocument->uri)['path'];
|
||||||
|
if (Glob::match($path, $glob)) {
|
||||||
|
$uris[] = $textDocument->uri;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $uris;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace LanguageServer\FilesFinder;
|
||||||
|
|
||||||
|
use Webmozart\Glob\Iterator\GlobIterator;
|
||||||
|
use Sabre\Event\Promise;
|
||||||
|
use function Sabre\Event\coroutine;
|
||||||
|
use function LanguageServer\{pathToUri, timeout};
|
||||||
|
|
||||||
|
class FileSystemFilesFinder implements FilesFinder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns all files in the workspace that match a glob.
|
||||||
|
* If the client does not support workspace/xfiles, it falls back to searching the file system directly.
|
||||||
|
*
|
||||||
|
* @param string $glob
|
||||||
|
* @return Promise <string[]>
|
||||||
|
*/
|
||||||
|
public function find(string $glob): Promise
|
||||||
|
{
|
||||||
|
return coroutine(function () use ($glob) {
|
||||||
|
$uris = [];
|
||||||
|
foreach (new GlobIterator($glob) as $path) {
|
||||||
|
$uris[] = pathToUri($path);
|
||||||
|
yield timeout();
|
||||||
|
}
|
||||||
|
return $uris;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace LanguageServer\FilesFinder;
|
||||||
|
|
||||||
|
use Sabre\Event\Promise;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface for finding files in the workspace
|
||||||
|
*/
|
||||||
|
interface FilesFinder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns all files in the workspace that match a glob.
|
||||||
|
* If the client does not support workspace/xfiles, it falls back to searching the file system directly.
|
||||||
|
*
|
||||||
|
* @param string $glob
|
||||||
|
* @return Promise <string[]>
|
||||||
|
*/
|
||||||
|
public function find(string $glob): Promise;
|
||||||
|
}
|
|
@ -14,13 +14,13 @@ use LanguageServer\Protocol\{
|
||||||
TextDocumentIdentifier,
|
TextDocumentIdentifier,
|
||||||
CompletionOptions
|
CompletionOptions
|
||||||
};
|
};
|
||||||
|
use LanguageServer\FilesFinder\{FilesFinder, ClientFilesFinder, FileSystemFilesFinder};
|
||||||
|
use LanguageServer\ContentRetriever\{ContentRetriever, ClientContentRetriever, FileSystemContentRetriever};
|
||||||
use AdvancedJsonRpc;
|
use AdvancedJsonRpc;
|
||||||
use Sabre\Event\{Loop, Promise};
|
use Sabre\Event\{Loop, Promise};
|
||||||
use function Sabre\Event\coroutine;
|
use function Sabre\Event\coroutine;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
use Webmozart\Glob\Iterator\GlobIterator;
|
|
||||||
use Webmozart\Glob\Glob;
|
|
||||||
use Webmozart\PathUtil\Path;
|
use Webmozart\PathUtil\Path;
|
||||||
use Sabre\Uri;
|
use Sabre\Uri;
|
||||||
|
|
||||||
|
@ -45,11 +45,6 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
|
||||||
public $completionItem;
|
public $completionItem;
|
||||||
public $codeLens;
|
public $codeLens;
|
||||||
|
|
||||||
/**
|
|
||||||
* ClientCapabilities
|
|
||||||
*/
|
|
||||||
private $clientCapabilities;
|
|
||||||
|
|
||||||
private $protocolReader;
|
private $protocolReader;
|
||||||
private $protocolWriter;
|
private $protocolWriter;
|
||||||
private $client;
|
private $client;
|
||||||
|
@ -62,6 +57,16 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
|
||||||
private $rootPath;
|
private $rootPath;
|
||||||
private $project;
|
private $project;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var FilesFinder
|
||||||
|
*/
|
||||||
|
private $filesFinder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ContentRetriever
|
||||||
|
*/
|
||||||
|
private $contentRetrieverFinder;
|
||||||
|
|
||||||
public function __construct(ProtocolReader $reader, ProtocolWriter $writer)
|
public function __construct(ProtocolReader $reader, ProtocolWriter $writer)
|
||||||
{
|
{
|
||||||
parent::__construct($this, '/');
|
parent::__construct($this, '/');
|
||||||
|
@ -120,12 +125,25 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
|
||||||
public function initialize(ClientCapabilities $capabilities, string $rootPath = null, int $processId = null): InitializeResult
|
public function initialize(ClientCapabilities $capabilities, string $rootPath = null, int $processId = null): InitializeResult
|
||||||
{
|
{
|
||||||
return coroutine(function () use ($capabilities, $rootPath, $processId) {
|
return coroutine(function () use ($capabilities, $rootPath, $processId) {
|
||||||
|
|
||||||
$this->rootPath = $rootPath;
|
$this->rootPath = $rootPath;
|
||||||
$this->clientCapabilities = $capabilities;
|
|
||||||
|
if ($capabilities->xfilesProvider) {
|
||||||
|
$this->filesFinder = new ClientFilesFinder($this->client);
|
||||||
|
} else {
|
||||||
|
$this->filesFinder = new FileSystemFilesFinder;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($capabilities->xcontentProvider) {
|
||||||
|
$this->contentRetriever = new ClientContentRetriever($this->client);
|
||||||
|
} else {
|
||||||
|
$this->contentRetriever = new FileSystemContentRetriever;
|
||||||
|
}
|
||||||
|
|
||||||
// start building project index
|
// start building project index
|
||||||
if ($rootPath !== null) {
|
if ($rootPath !== null) {
|
||||||
$pattern = Path::makeAbsolute('**/{*.php,composer.lock}', $this->rootPath);
|
$pattern = Path::makeAbsolute('**/{*.php,composer.lock}', $this->rootPath);
|
||||||
|
$composerLockPattern = Path::makeAbsolute('**/composer.lock}', $this->rootPath);
|
||||||
$uris = yield $this->findFiles($pattern);
|
$uris = yield $this->findFiles($pattern);
|
||||||
|
|
||||||
// Find composer.lock files
|
// Find composer.lock files
|
||||||
|
@ -133,7 +151,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
|
||||||
$phpFiles = [];
|
$phpFiles = [];
|
||||||
foreach ($uris as $uri) {
|
foreach ($uris as $uri) {
|
||||||
if (Glob::match(Uri\parse($uri)['path'], $composerLockPattern)) {
|
if (Glob::match(Uri\parse($uri)['path'], $composerLockPattern)) {
|
||||||
$composerLockFiles[$uri] = json_decode(yield $this->getFileContent($uri));
|
$composerLockFiles[$uri] = json_decode(yield $this->contentRetriever->retrieve($uri));
|
||||||
} else {
|
} else {
|
||||||
$phpFiles[] = $uri;
|
$phpFiles[] = $uri;
|
||||||
}
|
}
|
||||||
|
@ -207,6 +225,7 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
|
||||||
|
|
||||||
// Parse PHP files
|
// Parse PHP files
|
||||||
foreach ($phpFiles as $i => $uri) {
|
foreach ($phpFiles as $i => $uri) {
|
||||||
|
|
||||||
// Give LS to the chance to handle requests while indexing
|
// Give LS to the chance to handle requests while indexing
|
||||||
yield timeout();
|
yield timeout();
|
||||||
$path = Uri\parse($uri);
|
$path = Uri\parse($uri);
|
||||||
|
@ -237,34 +256,4 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all PHP files in the workspace.
|
|
||||||
* If the client does not support workspace/files, it falls back to searching the file system directly.
|
|
||||||
*
|
|
||||||
* @param string $pattern
|
|
||||||
* @return Promise <string[]>
|
|
||||||
*/
|
|
||||||
private function findFiles(string $pattern): Promise
|
|
||||||
{
|
|
||||||
return coroutine(function () {
|
|
||||||
$uris = [];
|
|
||||||
if ($this->clientCapabilities->xfilesProvider) {
|
|
||||||
// Use xfiles request
|
|
||||||
foreach (yield $this->client->workspace->xfiles() as $textDocument) {
|
|
||||||
$path = Uri\parse($textDocument->uri)['path'];
|
|
||||||
if (Glob::match($path, $pattern)) {
|
|
||||||
$uris[] = $textDocument->uri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Use the file system
|
|
||||||
foreach (new GlobIterator($pattern) as $path) {
|
|
||||||
$uris[] = pathToUri($path);
|
|
||||||
yield timeout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $uris;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
123
src/Project.php
123
src/Project.php
|
@ -5,6 +5,7 @@ namespace LanguageServer;
|
||||||
|
|
||||||
use LanguageServer\Protocol\{SymbolInformation, TextDocumentIdentifier, ClientCapabilities};
|
use LanguageServer\Protocol\{SymbolInformation, TextDocumentIdentifier, ClientCapabilities};
|
||||||
use phpDocumentor\Reflection\DocBlockFactory;
|
use phpDocumentor\Reflection\DocBlockFactory;
|
||||||
|
use LanguageServer\ContentRetriever\ContentRetriever;
|
||||||
use Sabre\Event\Promise;
|
use Sabre\Event\Promise;
|
||||||
use function Sabre\Event\coroutine;
|
use function Sabre\Event\coroutine;
|
||||||
|
|
||||||
|
@ -69,11 +70,11 @@ class Project
|
||||||
private $client;
|
private $client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The client's capabilities
|
* The content retriever
|
||||||
*
|
*
|
||||||
* @var ClientCapabilities
|
* @var ContentRetriever
|
||||||
*/
|
*/
|
||||||
private $clientCapabilities;
|
private $contentRetriever;
|
||||||
|
|
||||||
private $rootPath;
|
private $rootPath;
|
||||||
|
|
||||||
|
@ -92,11 +93,11 @@ class Project
|
||||||
string $rootPath = null
|
string $rootPath = null
|
||||||
) {
|
) {
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
$this->clientCapabilities = $clientCapabilities;
|
|
||||||
$this->rootPath = $rootPath;
|
$this->rootPath = $rootPath;
|
||||||
$this->parser = new Parser;
|
$this->parser = new Parser;
|
||||||
$this->docBlockFactory = DocBlockFactory::createInstance();
|
$this->docBlockFactory = DocBlockFactory::createInstance();
|
||||||
$this->definitionResolver = new DefinitionResolver($this);
|
$this->definitionResolver = new DefinitionResolver($this);
|
||||||
|
$this->contentRetriever = $contentRetriever;
|
||||||
$this->composerLockFiles = $composerLockFiles;
|
$this->composerLockFiles = $composerLockFiles;
|
||||||
// The index for the project itself
|
// The index for the project itself
|
||||||
$this->indexes[''] = new Index;
|
$this->indexes[''] = new Index;
|
||||||
|
@ -137,8 +138,9 @@ class Project
|
||||||
public function loadDocument(string $uri): Promise
|
public function loadDocument(string $uri): Promise
|
||||||
{
|
{
|
||||||
return coroutine(function () use ($uri) {
|
return coroutine(function () use ($uri) {
|
||||||
|
|
||||||
$limit = 150000;
|
$limit = 150000;
|
||||||
$content = yield $this->getFileContent($uri);
|
$content = yield $this->contentRetriever->retrieve($uri);
|
||||||
$size = strlen($content);
|
$size = strlen($content);
|
||||||
if ($size > $limit) {
|
if ($size > $limit) {
|
||||||
throw new ContentTooLargeException($uri, $size, $limit);
|
throw new ContentTooLargeException($uri, $size, $limit);
|
||||||
|
@ -199,25 +201,6 @@ class Project
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the content of a document depending on the client's capabilities
|
|
||||||
*
|
|
||||||
* @param string $uri
|
|
||||||
* @return Promise
|
|
||||||
*/
|
|
||||||
public function getFileContent(string $uri): Promise
|
|
||||||
{
|
|
||||||
if ($this->clientCapabilities->xcontentProvider) {
|
|
||||||
return $this->client->textDocument->xcontent(new TextDocumentIdentifier($uri))
|
|
||||||
->then(function (TextDocumentItem $textDocumentItem) {
|
|
||||||
return $textDocumentItem->text;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$path = uriToPath($uri);
|
|
||||||
return Promise\resolve(file_get_contents($path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures a document is loaded and added to the list of open documents.
|
* Ensures a document is loaded and added to the list of open documents.
|
||||||
*
|
*
|
||||||
|
@ -428,96 +411,4 @@ class Project
|
||||||
{
|
{
|
||||||
return isset($this->definitions[$fqn]);
|
return isset($this->definitions[$fqn]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Will read and parse all source files in the project and add them to the appropiate indexes
|
|
||||||
*
|
|
||||||
* @return Promise <void>
|
|
||||||
*/
|
|
||||||
private function index(): Promise
|
|
||||||
{
|
|
||||||
return coroutine(function () {
|
|
||||||
|
|
||||||
$pattern = Path::makeAbsolute('**/{*.php,composer.lock}', $this->rootPath);
|
|
||||||
$phpPattern = Path::makeAbsolute('**/*.php', $this->rootPath);
|
|
||||||
$composerLockPattern = Path::makeAbsolute('**/composer.lock', $this->rootPath);
|
|
||||||
|
|
||||||
$uris = yield $this->findFiles($pattern);
|
|
||||||
$count = count($uris);
|
|
||||||
|
|
||||||
$startTime = microtime(true);
|
|
||||||
|
|
||||||
// Find composer.lock files
|
|
||||||
$this->composerLockFiles = [];
|
|
||||||
foreach ($uris as $uri) {
|
|
||||||
if (Glob::match($path, $composerLockPattern)) {
|
|
||||||
$this->composerLockFiles[$uri] = json_decode(yield $this->getFileContent($uri));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Parse PHP files
|
|
||||||
foreach ($uris as $i => $uri) {
|
|
||||||
// Give LS to the chance to handle requests while indexing
|
|
||||||
yield timeout();
|
|
||||||
$path = Uri\parse($uri);
|
|
||||||
if (!Glob::match($path, $phpPattern)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$this->client->window->logMessage(
|
|
||||||
MessageType::LOG,
|
|
||||||
"Parsing file $i/$count: {$uri}"
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
yield $this->project->loadDocument($uri);
|
|
||||||
} catch (ContentTooLargeException $e) {
|
|
||||||
$this->client->window->logMessage(
|
|
||||||
MessageType::INFO,
|
|
||||||
"Ignoring file {$uri} because it exceeds size limit of {$e->limit} bytes ({$e->size})"
|
|
||||||
);
|
|
||||||
} catch (Exception $e) {
|
|
||||||
$this->client->window->logMessage(
|
|
||||||
MessageType::ERROR,
|
|
||||||
"Error parsing file {$uri}: " . (string)$e
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$duration = (int)(microtime(true) - $startTime);
|
|
||||||
$mem = (int)(memory_get_usage(true) / (1024 * 1024));
|
|
||||||
$this->client->window->logMessage(
|
|
||||||
MessageType::INFO,
|
|
||||||
"All $count PHP files parsed in $duration seconds. $mem MiB allocated."
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns all PHP files in the workspace.
|
|
||||||
* If the client does not support workspace/files, it falls back to searching the file system directly.
|
|
||||||
*
|
|
||||||
* @param string $pattern
|
|
||||||
* @return Promise <string[]>
|
|
||||||
*/
|
|
||||||
private function findFiles(string $pattern): Promise
|
|
||||||
{
|
|
||||||
return coroutine(function () {
|
|
||||||
$uris = [];
|
|
||||||
if ($this->clientCapabilities->xfilesProvider) {
|
|
||||||
// Use xfiles request
|
|
||||||
foreach (yield $this->client->workspace->xfiles() as $textDocument) {
|
|
||||||
$path = Uri\parse($textDocument->uri)['path'];
|
|
||||||
if (Glob::match($path, $pattern)) {
|
|
||||||
$uris[] = $textDocument->uri;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Use the file system
|
|
||||||
foreach (new GlobIterator($pattern) as $path) {
|
|
||||||
$uris[] = pathToUri($path);
|
|
||||||
yield timeout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $uris;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
use PhpParser\{NodeTraverser, Node};
|
use PhpParser\{NodeTraverser, Node};
|
||||||
use PhpParser\NodeVisitor\NameResolver;
|
use PhpParser\NodeVisitor\NameResolver;
|
||||||
use LanguageServer\{LanguageClient, Project, PhpDocument, Parser, DefinitionResolver};
|
use LanguageServer\{LanguageClient, Project, PhpDocument, Parser, DefinitionResolver};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\ClientCapabilities;
|
use LanguageServer\Protocol\ClientCapabilities;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\NodeVisitor\{ReferencesAdder, DefinitionCollector};
|
use LanguageServer\NodeVisitor\{ReferencesAdder, DefinitionCollector};
|
||||||
|
@ -17,7 +18,7 @@ class DefinitionCollectorTest extends TestCase
|
||||||
public function testCollectsSymbols()
|
public function testCollectsSymbols()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$parser = new Parser;
|
$parser = new Parser;
|
||||||
$uri = pathToUri(realpath(__DIR__ . '/../../fixtures/symbols.php'));
|
$uri = pathToUri(realpath(__DIR__ . '/../../fixtures/symbols.php'));
|
||||||
$document = $project->loadDocument($uri)->wait();
|
$document = $project->loadDocument($uri)->wait();
|
||||||
|
@ -57,7 +58,7 @@ class DefinitionCollectorTest extends TestCase
|
||||||
public function testDoesNotCollectReferences()
|
public function testDoesNotCollectReferences()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$parser = new Parser;
|
$parser = new Parser;
|
||||||
$uri = pathToUri(realpath(__DIR__ . '/../../fixtures/references.php'));
|
$uri = pathToUri(realpath(__DIR__ . '/../../fixtures/references.php'));
|
||||||
$document = $project->loadDocument($uri)->wait();
|
$document = $project->loadDocument($uri)->wait();
|
||||||
|
|
|
@ -7,6 +7,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{LanguageClient, Project};
|
use LanguageServer\{LanguageClient, Project};
|
||||||
use LanguageServer\NodeVisitor\NodeAtPositionFinder;
|
use LanguageServer\NodeVisitor\NodeAtPositionFinder;
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{SymbolKind, Position, ClientCapabilities};
|
use LanguageServer\Protocol\{SymbolKind, Position, ClientCapabilities};
|
||||||
use PhpParser\Node;
|
use PhpParser\Node;
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ class PhpDocumentTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$this->project = new Project($client, new ClientCapabilities);
|
$this->project = new Project($client, new FileSystemContentRetriever);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParsesVariableVariables()
|
public function testParsesVariableVariables()
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, Client, LanguageClient, Project, PhpDocument};
|
use LanguageServer\{Server, Client, LanguageClient, Project, PhpDocument};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{
|
use LanguageServer\Protocol\{
|
||||||
TextDocumentItem,
|
TextDocumentItem,
|
||||||
TextDocumentIdentifier,
|
TextDocumentIdentifier,
|
||||||
|
@ -27,7 +28,7 @@ class ProjectTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$this->project = new Project($client, new ClientCapabilities);
|
$this->project = new Project($client, new FileSystemContentRetriever);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetOrLoadDocumentLoadsDocument()
|
public function testGetOrLoadDocumentLoadsDocument()
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, LanguageClient, Project};
|
use LanguageServer\{Server, LanguageClient, Project};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{Position, Location, Range, ClientCapabilities};
|
use LanguageServer\Protocol\{Position, Location, Range, ClientCapabilities};
|
||||||
use function LanguageServer\pathToUri;
|
use function LanguageServer\pathToUri;
|
||||||
use Sabre\Event\Promise;
|
use Sabre\Event\Promise;
|
||||||
|
@ -44,7 +45,7 @@ abstract class ServerTestCase extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$this->project = new Project($client, new ClientCapabilities);
|
$this->project = new Project($client, new FileSystemContentRetriever);
|
||||||
$this->textDocument = new Server\TextDocument($this->project, $client);
|
$this->textDocument = new Server\TextDocument($this->project, $client);
|
||||||
$this->workspace = new Server\Workspace($this->project, $client);
|
$this->workspace = new Server\Workspace($this->project, $client);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server\TextDocument;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, LanguageClient, Project, CompletionProvider};
|
use LanguageServer\{Server, LanguageClient, Project, CompletionProvider};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{
|
use LanguageServer\Protocol\{
|
||||||
TextDocumentIdentifier,
|
TextDocumentIdentifier,
|
||||||
TextEdit,
|
TextEdit,
|
||||||
|
@ -33,7 +34,7 @@ class CompletionTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$this->project = new Project($client, new ClientCapabilities);
|
$this->project = new Project($client, new FileSystemContentRetriever);
|
||||||
$this->project->loadDocument(pathToUri(__DIR__ . '/../../../fixtures/global_symbols.php'))->wait();
|
$this->project->loadDocument(pathToUri(__DIR__ . '/../../../fixtures/global_symbols.php'))->wait();
|
||||||
$this->project->loadDocument(pathToUri(__DIR__ . '/../../../fixtures/symbols.php'))->wait();
|
$this->project->loadDocument(pathToUri(__DIR__ . '/../../../fixtures/symbols.php'))->wait();
|
||||||
$this->textDocument = new Server\TextDocument($this->project, $client);
|
$this->textDocument = new Server\TextDocument($this->project, $client);
|
||||||
|
@ -254,10 +255,25 @@ class CompletionTest extends TestCase
|
||||||
new Position(2, 13)
|
new Position(2, 13)
|
||||||
)->wait();
|
)->wait();
|
||||||
$this->assertEquals(new CompletionList([
|
$this->assertEquals(new CompletionList([
|
||||||
|
new CompletionItem(
|
||||||
|
'TEST_CLASS_CONST',
|
||||||
|
CompletionItemKind::VARIABLE,
|
||||||
|
'int',
|
||||||
|
'Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad.'
|
||||||
|
),
|
||||||
|
new CompletionItem(
|
||||||
|
'staticTestProperty',
|
||||||
|
CompletionItemKind::PROPERTY,
|
||||||
|
'\TestClass[]',
|
||||||
|
'Lorem excepteur officia sit anim velit veniam enim.',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
'$staticTestProperty'
|
||||||
|
),
|
||||||
new CompletionItem(
|
new CompletionItem(
|
||||||
'staticTestMethod',
|
'staticTestMethod',
|
||||||
CompletionItemKind::METHOD,
|
CompletionItemKind::METHOD,
|
||||||
'mixed', // Method return type
|
'mixed',
|
||||||
'Do magna consequat veniam minim proident eiusmod incididunt aute proident.'
|
'Do magna consequat veniam minim proident eiusmod incididunt aute proident.'
|
||||||
)
|
)
|
||||||
], true), $items);
|
], true), $items);
|
||||||
|
@ -277,6 +293,21 @@ class CompletionTest extends TestCase
|
||||||
CompletionItemKind::VARIABLE,
|
CompletionItemKind::VARIABLE,
|
||||||
'int',
|
'int',
|
||||||
'Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad.'
|
'Anim labore veniam consectetur laboris minim quis aute aute esse nulla ad.'
|
||||||
|
),
|
||||||
|
new CompletionItem(
|
||||||
|
'staticTestProperty',
|
||||||
|
CompletionItemKind::PROPERTY,
|
||||||
|
'\TestClass[]',
|
||||||
|
'Lorem excepteur officia sit anim velit veniam enim.',
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
'$staticTestProperty'
|
||||||
|
),
|
||||||
|
new CompletionItem(
|
||||||
|
'staticTestMethod',
|
||||||
|
CompletionItemKind::METHOD,
|
||||||
|
'mixed',
|
||||||
|
'Do magna consequat veniam minim proident eiusmod incididunt aute proident.'
|
||||||
)
|
)
|
||||||
], true), $items);
|
], true), $items);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server\TextDocument\Definition;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\Tests\Server\ServerTestCase;
|
use LanguageServer\Tests\Server\ServerTestCase;
|
||||||
use LanguageServer\{Server, LanguageClient, Project};
|
use LanguageServer\{Server, LanguageClient, Project};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{TextDocumentIdentifier, Position, Range, Location, ClientCapabilities};
|
use LanguageServer\Protocol\{TextDocumentIdentifier, Position, Range, Location, ClientCapabilities};
|
||||||
use Sabre\Event\Promise;
|
use Sabre\Event\Promise;
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ class GlobalFallbackTest extends ServerTestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$this->textDocument = new Server\TextDocument($project, $client);
|
$this->textDocument = new Server\TextDocument($project, $client);
|
||||||
$project->openDocument('global_fallback', file_get_contents(__DIR__ . '/../../../../fixtures/global_fallback.php'));
|
$project->openDocument('global_fallback', file_get_contents(__DIR__ . '/../../../../fixtures/global_fallback.php'));
|
||||||
$project->openDocument('global_symbols', file_get_contents(__DIR__ . '/../../../../fixtures/global_symbols.php'));
|
$project->openDocument('global_symbols', file_get_contents(__DIR__ . '/../../../../fixtures/global_symbols.php'));
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server\TextDocument;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, Client, LanguageClient, Project};
|
use LanguageServer\{Server, Client, LanguageClient, Project};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{
|
use LanguageServer\Protocol\{
|
||||||
TextDocumentIdentifier,
|
TextDocumentIdentifier,
|
||||||
TextDocumentItem,
|
TextDocumentItem,
|
||||||
|
@ -21,7 +22,7 @@ class DidChangeTest extends TestCase
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$textDocument = new Server\TextDocument($project, $client);
|
$textDocument = new Server\TextDocument($project, $client);
|
||||||
$phpDocument = $project->openDocument('whatever', "<?php\necho 'Hello, World'\n");
|
$phpDocument = $project->openDocument('whatever', "<?php\necho 'Hello, World'\n");
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server\TextDocument;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, Client, LanguageClient, Project};
|
use LanguageServer\{Server, Client, LanguageClient, Project};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{TextDocumentItem, TextDocumentIdentifier, ClientCapabilities};
|
use LanguageServer\Protocol\{TextDocumentItem, TextDocumentIdentifier, ClientCapabilities};
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ class DidCloseTest extends TestCase
|
||||||
public function test()
|
public function test()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$textDocument = new Server\TextDocument($project, $client);
|
$textDocument = new Server\TextDocument($project, $client);
|
||||||
$phpDocument = $project->openDocument('whatever', 'hello world');
|
$phpDocument = $project->openDocument('whatever', 'hello world');
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server\TextDocument;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, Client, LanguageClient, Project};
|
use LanguageServer\{Server, Client, LanguageClient, Project};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{
|
use LanguageServer\Protocol\{
|
||||||
TextDocumentIdentifier,
|
TextDocumentIdentifier,
|
||||||
TextDocumentItem,
|
TextDocumentItem,
|
||||||
|
@ -27,14 +28,14 @@ class FormattingTest extends TestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$this->textDocument = new Server\TextDocument($project, $client);
|
$this->textDocument = new Server\TextDocument($project, $client);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormatting()
|
public function testFormatting()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$textDocument = new Server\TextDocument($project, $client);
|
$textDocument = new Server\TextDocument($project, $client);
|
||||||
$path = realpath(__DIR__ . '/../../../fixtures/format.php');
|
$path = realpath(__DIR__ . '/../../../fixtures/format.php');
|
||||||
$uri = pathToUri($path);
|
$uri = pathToUri($path);
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server\TextDocument;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, Client, LanguageClient, Project, ClientHandler};
|
use LanguageServer\{Server, Client, LanguageClient, Project, ClientHandler};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{TextDocumentIdentifier, TextDocumentItem, DiagnosticSeverity, ClientCapabilities};
|
use LanguageServer\Protocol\{TextDocumentIdentifier, TextDocumentItem, DiagnosticSeverity, ClientCapabilities};
|
||||||
use Sabre\Event\Promise;
|
use Sabre\Event\Promise;
|
||||||
use JsonMapper;
|
use JsonMapper;
|
||||||
|
@ -35,7 +36,7 @@ class ParseErrorsTest extends TestCase
|
||||||
return Promise\resolve(null);
|
return Promise\resolve(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$this->textDocument = new Server\TextDocument($project, $client);
|
$this->textDocument = new Server\TextDocument($project, $client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace LanguageServer\Tests\Server\TextDocument\References;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use LanguageServer\Tests\MockProtocolStream;
|
use LanguageServer\Tests\MockProtocolStream;
|
||||||
use LanguageServer\{Server, LanguageClient, Project};
|
use LanguageServer\{Server, LanguageClient, Project};
|
||||||
|
use LanguageServer\ContentRetriever\FileSystemContentRetriever;
|
||||||
use LanguageServer\Protocol\{TextDocumentIdentifier, Position, ReferenceContext, Location, Range, ClientCapabilities};
|
use LanguageServer\Protocol\{TextDocumentIdentifier, Position, ReferenceContext, Location, Range, ClientCapabilities};
|
||||||
use LanguageServer\Tests\Server\ServerTestCase;
|
use LanguageServer\Tests\Server\ServerTestCase;
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@ class GlobalFallbackTest extends ServerTestCase
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
$client = new LanguageClient(new MockProtocolStream, new MockProtocolStream);
|
||||||
$project = new Project($client, new ClientCapabilities);
|
$project = new Project($client, new FileSystemContentRetriever);
|
||||||
$this->textDocument = new Server\TextDocument($project, $client);
|
$this->textDocument = new Server\TextDocument($project, $client);
|
||||||
$project->openDocument('global_fallback', file_get_contents(__DIR__ . '/../../../../fixtures/global_fallback.php'));
|
$project->openDocument('global_fallback', file_get_contents(__DIR__ . '/../../../../fixtures/global_fallback.php'));
|
||||||
$project->openDocument('global_symbols', file_get_contents(__DIR__ . '/../../../../fixtures/global_symbols.php'));
|
$project->openDocument('global_symbols', file_get_contents(__DIR__ . '/../../../../fixtures/global_symbols.php'));
|
||||||
|
|
Loading…
Reference in New Issue