diff --git a/src/Server/Workspace.php b/src/Server/Workspace.php index 7f76977..e74490e 100644 --- a/src/Server/Workspace.php +++ b/src/Server/Workspace.php @@ -225,18 +225,17 @@ class Workspace } $changedOptions = $this->getChangedOptions($settings); - $this->options = $settings; - if (!empty(array_intersect($changedOptions, $this->options->getIndexerOptions()))) { + foreach (get_object_vars($settings) as $prop => $val) { + $this->options->$prop = $val; + } + + if ($this->indexer && !empty(array_intersect($changedOptions, $this->options->getIndexerOptions()))) { // check list of options that changed since last time against the list of valid indexer options - // start wiping from the main index + // wipe main index and start reindexing $this->index->wipe(); - - // check for existing indexer and start indexing - if ($this->indexer) { - $this->indexer->index()->otherwise('\\LanguageServer\\crash'); - } + $this->indexer->index()->otherwise('\\LanguageServer\\crash'); } } diff --git a/tests/Server/Workspace/DidChangeConfigurationTest.php b/tests/Server/Workspace/DidChangeConfigurationTest.php index 18970e9..8479764 100644 --- a/tests/Server/Workspace/DidChangeConfigurationTest.php +++ b/tests/Server/Workspace/DidChangeConfigurationTest.php @@ -51,7 +51,7 @@ class DidChangeConfigurationTest extends ServerTestCase if ($msg->body->method === 'window/logMessage' && $promise->state === Promise::PENDING) { if ($msg->body->params->type === MessageType::ERROR) { $promise->reject(new Exception($msg->body->params->message)); - } elseif (strpos($msg->body->params->message, 'All 0 PHP files parsed') !== false) { + } elseif (strpos($msg->body->params->message, 'All 1 PHP files parsed') !== false) { $promise->fulfill(); } }