diff --git a/src/Index/AbstractAggregateIndex.php b/src/Index/AbstractAggregateIndex.php index 5377c3a..39c1a1d 100644 --- a/src/Index/AbstractAggregateIndex.php +++ b/src/Index/AbstractAggregateIndex.php @@ -42,6 +42,9 @@ abstract class AbstractAggregateIndex implements ReadableIndex $index->on('definition-added', function () { $this->emit('definition-added'); }); + $index->on('wipe', function() { + $this->emit('wipe'); + }); } /** @@ -147,4 +150,14 @@ abstract class AbstractAggregateIndex implements ReadableIndex } return $refs; } + + /** + * Wipe all indexes for a reindex + */ + public function wipe() + { + foreach ($this->getIndexes() as $index) { + $index->wipe(); + } + } } diff --git a/src/Index/Index.php b/src/Index/Index.php index 5c24813..e912087 100644 --- a/src/Index/Index.php +++ b/src/Index/Index.php @@ -211,4 +211,14 @@ class Index implements ReadableIndex, \Serializable 'staticComplete' => $this->staticComplete ]); } + + public function wipe() + { + $this->definitions = []; + $this->references = []; + $this->complete = false; + $this->staticComplete = false; + + $this->emit('wipe'); + } } diff --git a/src/Server/Workspace.php b/src/Server/Workspace.php index b94618c..3a10b78 100644 --- a/src/Server/Workspace.php +++ b/src/Server/Workspace.php @@ -170,4 +170,9 @@ class Workspace } return $dependencyReferences; } + + public function didChangeConfiguration($settings = null) + { + $this->index->wipe(); + } }