mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
commit
038947eb08
@ -142,11 +142,6 @@ class LanguageServer extends Dispatcher
|
||||
return;
|
||||
}
|
||||
|
||||
/** @psalm-suppress UndefinedPropertyFetch */
|
||||
if ($msg->body->method === 'textDocument/signatureHelp') {
|
||||
$this->doAnalysis();
|
||||
}
|
||||
|
||||
$result = null;
|
||||
$error = null;
|
||||
try {
|
||||
|
@ -6,7 +6,6 @@ namespace Psalm\Internal\LanguageServer\Server;
|
||||
|
||||
use Amp\Promise;
|
||||
use Amp\Success;
|
||||
use InvalidArgumentException;
|
||||
use LanguageServerProtocol\CompletionList;
|
||||
use LanguageServerProtocol\Hover;
|
||||
use LanguageServerProtocol\Location;
|
||||
@ -27,7 +26,6 @@ use Psalm\Internal\Analyzer\ProjectAnalyzer;
|
||||
use Psalm\Internal\LanguageServer\LanguageServer;
|
||||
use UnexpectedValueException;
|
||||
|
||||
use function array_combine;
|
||||
use function array_values;
|
||||
use function count;
|
||||
use function error_log;
|
||||
@ -92,8 +90,9 @@ class TextDocument
|
||||
* The document save notification is sent from the client to the server when the document was saved in the client
|
||||
*
|
||||
* @param TextDocumentItem $textDocument the document that was opened
|
||||
* @param ?string $text the content when saved
|
||||
*/
|
||||
public function didSave(TextDocumentItem $textDocument): void
|
||||
public function didSave(TextDocumentItem $textDocument, ?string $text): void
|
||||
{
|
||||
$file_path = LanguageServer::uriToPath($textDocument->uri);
|
||||
|
||||
@ -103,7 +102,7 @@ class TextDocument
|
||||
|
||||
// reopen file
|
||||
$this->codebase->removeTemporaryFileChanges($file_path);
|
||||
$this->codebase->file_provider->setOpenContents($file_path, $textDocument->text);
|
||||
$this->codebase->file_provider->setOpenContents($file_path, (string) $text);
|
||||
|
||||
$this->server->queueFileAnalysis($file_path, $textDocument->uri);
|
||||
}
|
||||
@ -122,10 +121,6 @@ class TextDocument
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->project_analyzer->onchange_line_limit === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($contentChanges) === 1 && $contentChanges[0]->range === null) {
|
||||
$new_content = $contentChanges[0]->text;
|
||||
} else {
|
||||
@ -266,8 +261,6 @@ class TextDocument
|
||||
*/
|
||||
public function completion(TextDocumentIdentifier $textDocument, Position $position): Promise
|
||||
{
|
||||
$this->server->doAnalysis();
|
||||
|
||||
$file_path = LanguageServer::uriToPath($textDocument->uri);
|
||||
if (!$this->codebase->config->isInProjectDirs($file_path)) {
|
||||
return new Success([]);
|
||||
@ -361,18 +354,6 @@ class TextDocument
|
||||
return new Success(null);
|
||||
}
|
||||
|
||||
$all_file_paths_to_analyze = [$file_path];
|
||||
$this->codebase->analyzer->addFilesToAnalyze(
|
||||
array_combine($all_file_paths_to_analyze, $all_file_paths_to_analyze)
|
||||
);
|
||||
|
||||
try {
|
||||
$this->codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||
} catch (UnexpectedValueException | InvalidArgumentException $e) {
|
||||
error_log('codeAction errored on file ' . $file_path. ', Reason: '.$e->getMessage());
|
||||
return new Success(null);
|
||||
}
|
||||
|
||||
$issues = $this->server->getCurrentIssues();
|
||||
|
||||
if (empty($issues[$file_path])) {
|
||||
|
Loading…
Reference in New Issue
Block a user