1
0
Fork 0
php-language-server/src/Client/TextDocument.php

40 lines
901 B
PHP
Raw Normal View History

<?php
declare(strict_types = 1);
namespace LanguageServer\Client;
2016-10-31 10:47:21 +00:00
use LanguageServer\ClientHandler;
2016-10-11 13:28:53 +00:00
use LanguageServer\Protocol\Message;
2016-10-31 10:47:21 +00:00
use Sabre\Event\Promise;
/**
* Provides method handlers for all textDocument/* methods
*/
class TextDocument
{
/**
2016-10-31 10:47:21 +00:00
* @var ClientHandler
*/
2016-10-31 10:47:21 +00:00
private $handler;
2016-10-31 10:47:21 +00:00
public function __construct(ClientHandler $handler)
{
2016-10-31 10:47:21 +00:00
$this->handler = $handler;
}
/**
* Diagnostics notification are sent from the server to the client to signal results of validation runs.
*
* @param string $uri
* @param Diagnostic[] $diagnostics
2016-10-31 10:47:21 +00:00
* @return Promise <void>
*/
2016-10-31 10:47:21 +00:00
public function publishDiagnostics(string $uri, array $diagnostics): Promise
{
2016-10-31 10:47:21 +00:00
return $this->handler->notify('textDocument/publishDiagnostics', [
'uri' => $uri,
'diagnostics' => $diagnostics
]);
}
}