1
0
Fork 0

Make processId optional for initialization (#178)

pull/180/merge
Michal Niewrzal 2016-11-23 18:38:57 +01:00 committed by Felix Becker
parent 429114ff97
commit e8ab8aa2b8
2 changed files with 4 additions and 4 deletions

View File

@ -107,12 +107,12 @@ class LanguageServer extends AdvancedJsonRpc\Dispatcher
/** /**
* The initialize request is sent as the first request from the client to the server. * The initialize request is sent as the first request from the client to the server.
* *
* @param int $processId The process Id of the parent process that started the server.
* @param ClientCapabilities $capabilities The capabilities provided by the client (editor) * @param ClientCapabilities $capabilities The capabilities provided by the client (editor)
* @param string|null $rootPath The rootPath of the workspace. Is null if no folder is open. * @param string|null $rootPath The rootPath of the workspace. Is null if no folder is open.
* @param int|null $processId The process Id of the parent process that started the server. Is null if the process has not been started by another process. If the parent process is not alive then the server should exit (see exit notification) its process.
* @return InitializeResult * @return InitializeResult
*/ */
public function initialize(int $processId, ClientCapabilities $capabilities, string $rootPath = null): InitializeResult public function initialize(ClientCapabilities $capabilities, string $rootPath = null, int $processId = null): InitializeResult
{ {
$this->rootPath = $rootPath; $this->rootPath = $rootPath;
$this->clientCapabilities = $capabilities; $this->clientCapabilities = $capabilities;

View File

@ -68,7 +68,7 @@ class LanguageServerTest extends TestCase
}); });
$server = new LanguageServer($input, $output); $server = new LanguageServer($input, $output);
$capabilities = new ClientCapabilities; $capabilities = new ClientCapabilities;
$server->initialize(getmypid(), $capabilities, realpath(__DIR__ . '/../fixtures')); $server->initialize($capabilities, realpath(__DIR__ . '/../fixtures'), getmypid());
$promise->wait(); $promise->wait();
} }
@ -116,7 +116,7 @@ class LanguageServerTest extends TestCase
$capabilities = new ClientCapabilities; $capabilities = new ClientCapabilities;
$capabilities->xfilesProvider = true; $capabilities->xfilesProvider = true;
$capabilities->xcontentProvider = true; $capabilities->xcontentProvider = true;
$server->initialize(getmypid(), $capabilities, $rootPath); $server->initialize($capabilities, $rootPath, getmypid());
$promise->wait(); $promise->wait();
$this->assertTrue($filesCalled); $this->assertTrue($filesCalled);
$this->assertTrue($contentCalled); $this->assertTrue($contentCalled);