1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-11 08:49:52 +01:00

dont allow clients to destroy our local configurations

This commit is contained in:
Andrew Nagy 2022-04-27 19:34:46 +00:00
parent b3cc5c7f67
commit 6855c2307d
2 changed files with 13 additions and 5 deletions

View File

@ -85,10 +85,9 @@ class LanguageClient
if ($error) { if ($error) {
$this->server->logError('There was an error getting configuration'); $this->server->logError('There was an error getting configuration');
} else { } else {
/** @var array<int, array> $value */ /** @var array<int, object> $value */
[$config] = $value; [$config] = $value;
$this->mapper->map($config, $this->clientConfiguration); $this->configurationRefreshed((array) $config);
$this->configurationRefreshed();
} }
}); });
} }
@ -153,10 +152,19 @@ class LanguageClient
); );
} }
private function configurationRefreshed(): void /**
* Configuration Refreshed from Client
*
* @param array $config
*/
private function configurationRefreshed(array $config): void
{ {
//do things when the config is refreshed //do things when the config is refreshed
if (empty($config)) {
return;
}
if (!is_null($this->clientConfiguration->provideCompletion)) { if (!is_null($this->clientConfiguration->provideCompletion)) {
//$this->server->project_analyzer->provide_completion = $this->clientConfiguration->provideCompletion; //$this->server->project_analyzer->provide_completion = $this->clientConfiguration->provideCompletion;
} }

View File

@ -885,7 +885,7 @@ class LanguageServer extends Dispatcher
return; return;
} }
if ($type < $logLevel) { if ($type > $logLevel) {
return; return;
} }