1
0
Fork 0

Print null docs in language server perf log

pull/357/head
Sara Itani 2017-03-28 13:55:10 -07:00
parent 4ac56d83a4
commit a69c93b28b
1 changed files with 13 additions and 1 deletions

View File

@ -6,6 +6,7 @@ namespace LanguageServer;
use LanguageServer\Cache\Cache; use LanguageServer\Cache\Cache;
use LanguageServer\FilesFinder\FilesFinder; use LanguageServer\FilesFinder\FilesFinder;
use LanguageServer\Index\{DependenciesIndex, Index}; use LanguageServer\Index\{DependenciesIndex, Index};
use LanguageServer\Protocol\Message;
use LanguageServer\Protocol\MessageType; use LanguageServer\Protocol\MessageType;
use Webmozart\PathUtil\Path; use Webmozart\PathUtil\Path;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
@ -192,11 +193,19 @@ class Indexer
$mem = (int)(memory_get_usage(true) / (1024 * 1024)); $mem = (int)(memory_get_usage(true) / (1024 * 1024));
$this->client->window->logMessage( $this->client->window->logMessage(
MessageType::INFO, MessageType::INFO,
"All $count PHP files parsed in $duration seconds. $mem MiB allocated." "All $count PHP files parsed in $duration seconds. $mem MiB allocated. " . \count($this->nullDocs) . " null docs"
); );
foreach ($this->nullDocs as $nullDoc) {
$this->client->window->logMessage(
MessageType::INFO,
$nullDoc
);
}
}); });
} }
private $nullDocs = [];
/** /**
* @param array $files * @param array $files
* @return Promise * @return Promise
@ -215,6 +224,9 @@ class Indexer
$this->client->window->logMessage(MessageType::LOG, "Parsing $uri"); $this->client->window->logMessage(MessageType::LOG, "Parsing $uri");
try { try {
$document = yield $this->documentLoader->load($uri); $document = yield $this->documentLoader->load($uri);
if ($document->getStmts() === null) {
$this->nullDocs[] = $document->getUri();
}
if (!isVendored($document, $this->composerJson)) { if (!isVendored($document, $this->composerJson)) {
$this->client->textDocument->publishDiagnostics($uri, $document->getDiagnostics()); $this->client->textDocument->publishDiagnostics($uri, $document->getDiagnostics());
} }