Let didChangeConfiguration decide what options are interesting for the indexer
parent
a06057b7a3
commit
23a40f069b
|
@ -11,11 +11,6 @@ class Options
|
||||||
*/
|
*/
|
||||||
public $fileTypes = ['.php'];
|
public $fileTypes = ['.php'];
|
||||||
|
|
||||||
/**
|
|
||||||
* List of options that affect the indexer
|
|
||||||
*/
|
|
||||||
private $indexerOptions = ['fileTypes'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate/Filter input and set options for file types
|
* Validate/Filter input and set options for file types
|
||||||
*
|
*
|
||||||
|
@ -31,16 +26,6 @@ class Options
|
||||||
$this->fileTypes = !empty($fileTypes) ? $fileTypes : $this->fileTypes;
|
$this->fileTypes = !empty($fileTypes) ? $fileTypes : $this->fileTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get list with options that affect the indexer
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getIndexerOptions(): array
|
|
||||||
{
|
|
||||||
return $this->indexerOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter valid file type
|
* Filter valid file type
|
||||||
*
|
*
|
||||||
|
|
|
@ -229,6 +229,9 @@ class Workspace
|
||||||
*/
|
*/
|
||||||
public function didChangeConfiguration($settings = null): bool
|
public function didChangeConfiguration($settings = null): bool
|
||||||
{
|
{
|
||||||
|
// List of options that affect the indexer
|
||||||
|
$indexerOptions = ['fileTypes'];
|
||||||
|
|
||||||
if ($settings === null) {
|
if ($settings === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +256,7 @@ class Workspace
|
||||||
$this->options->$prop = $val;
|
$this->options->$prop = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->indexer && !empty(array_intersect($changedOptions, $this->options->getIndexerOptions()))) {
|
if ($this->indexer && !empty(array_intersect($changedOptions, $indexerOptions))) {
|
||||||
// check list of options that changed since last time against the list of valid indexer options
|
// check list of options that changed since last time against the list of valid indexer options
|
||||||
|
|
||||||
// wipe main index and start reindexing
|
// wipe main index and start reindexing
|
||||||
|
|
Loading…
Reference in New Issue