From eb963b0905ad9f4bfd8489c61ef03c22e1bb9cd6 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Tue, 18 Oct 2016 11:16:18 +0200 Subject: [PATCH] Instantiate Project in intialize() This should allow to re-initialize the LS for a different project without restarting it --- src/LanguageServer.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/LanguageServer.php b/src/LanguageServer.php index 21c7d2b..420f558 100644 --- a/src/LanguageServer.php +++ b/src/LanguageServer.php @@ -72,11 +72,6 @@ class LanguageServer extends \AdvancedJsonRpc\Dispatcher }); $this->protocolWriter = $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 { + // 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 if ($rootPath) { $this->indexProject($rootPath); @@ -120,7 +120,7 @@ class LanguageServer extends \AdvancedJsonRpc\Dispatcher */ public function shutdown() { - + unset($this->project); } /**