1
0
Fork 0

Instantiate Project in intialize()

This should allow to re-initialize the LS for a different project without restarting it
pull/89/head
Felix Becker 2016-10-18 11:16:18 +02:00
parent 691a0bddfe
commit eb963b0905
1 changed files with 6 additions and 6 deletions

View File

@ -72,11 +72,6 @@ class LanguageServer extends \AdvancedJsonRpc\Dispatcher
}); });
$this->protocolWriter = $writer; $this->protocolWriter = $writer;
$this->client = new LanguageClient($writer); $this->client = new LanguageClient($writer);
$this->project = new Project($this->client);
$this->textDocument = new Server\TextDocument($this->project, $this->client);
$this->workspace = new Server\Workspace($this->project, $this->client);
} }
/** /**
@ -89,6 +84,11 @@ class LanguageServer extends \AdvancedJsonRpc\Dispatcher
*/ */
public function initialize(int $processId, ClientCapabilities $capabilities, string $rootPath = null): InitializeResult public function initialize(int $processId, ClientCapabilities $capabilities, string $rootPath = null): InitializeResult
{ {
// Initialize project
$this->project = new Project($this->client);
$this->textDocument = new Server\TextDocument($this->project, $this->client);
$this->workspace = new Server\Workspace($this->project, $this->client);
// start building project index // start building project index
if ($rootPath) { if ($rootPath) {
$this->indexProject($rootPath); $this->indexProject($rootPath);
@ -120,7 +120,7 @@ class LanguageServer extends \AdvancedJsonRpc\Dispatcher
*/ */
public function shutdown() public function shutdown()
{ {
unset($this->project);
} }
/** /**