2016-09-30 09:30:08 +00:00
|
|
|
<?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;
|
2016-09-30 09:30:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Provides method handlers for all window/* methods
|
|
|
|
*/
|
|
|
|
class Window
|
|
|
|
{
|
|
|
|
/**
|
2016-10-31 10:47:21 +00:00
|
|
|
* @var ClientHandler
|
2016-09-30 09:30:08 +00:00
|
|
|
*/
|
2016-10-31 10:47:21 +00:00
|
|
|
private $handler;
|
2016-09-30 09:30:08 +00:00
|
|
|
|
2016-10-31 10:47:21 +00:00
|
|
|
public function __construct(ClientHandler $handler)
|
2016-09-30 09:30:08 +00:00
|
|
|
{
|
2016-10-31 10:47:21 +00:00
|
|
|
$this->handler = $handler;
|
2016-09-30 09:30:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2016-10-31 10:47:21 +00:00
|
|
|
* The show message notification is sent from a server to a client
|
|
|
|
* to ask the client to display a particular message in the user interface.
|
2016-09-30 09:30:08 +00:00
|
|
|
*
|
|
|
|
* @param int $type
|
|
|
|
* @param string $message
|
2016-10-31 10:47:21 +00:00
|
|
|
* @return Promise <void>
|
2016-09-30 09:30:08 +00:00
|
|
|
*/
|
2016-10-31 10:47:21 +00:00
|
|
|
public function showMessage(int $type, string $message): Promise
|
2016-09-30 09:30:08 +00:00
|
|
|
{
|
2016-10-31 10:47:21 +00:00
|
|
|
return $this->handler->notify('window/showMessage', ['type' => $type, 'message' => $message]);
|
2016-09-30 09:30:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The log message notification is sent from the server to the client to ask the client to log a particular message.
|
|
|
|
*
|
|
|
|
* @param int $type
|
|
|
|
* @param string $message
|
2016-10-31 10:47:21 +00:00
|
|
|
* @return Promise <void>
|
2016-09-30 09:30:08 +00:00
|
|
|
*/
|
2016-10-31 10:47:21 +00:00
|
|
|
public function logMessage(int $type, string $message): Promise
|
2016-09-30 09:30:08 +00:00
|
|
|
{
|
2016-10-31 10:47:21 +00:00
|
|
|
return $this->handler->notify('window/logMessage', ['type' => $type, 'message' => $message]);
|
2016-09-30 09:30:08 +00:00
|
|
|
}
|
|
|
|
}
|