From 6855c2307dc62740ab0320a1081a4b0315dbbe1f Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Wed, 27 Apr 2022 19:34:46 +0000 Subject: [PATCH] dont allow clients to destroy our local configurations --- .../Internal/LanguageServer/LanguageClient.php | 16 ++++++++++++---- .../Internal/LanguageServer/LanguageServer.php | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Psalm/Internal/LanguageServer/LanguageClient.php b/src/Psalm/Internal/LanguageServer/LanguageClient.php index 791a86dec..a0afe20fb 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageClient.php +++ b/src/Psalm/Internal/LanguageServer/LanguageClient.php @@ -85,10 +85,9 @@ class LanguageClient if ($error) { $this->server->logError('There was an error getting configuration'); } else { - /** @var array $value */ + /** @var array $value */ [$config] = $value; - $this->mapper->map($config, $this->clientConfiguration); - $this->configurationRefreshed(); + $this->configurationRefreshed((array) $config); } }); } @@ -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 + if (empty($config)) { + return; + } + if (!is_null($this->clientConfiguration->provideCompletion)) { //$this->server->project_analyzer->provide_completion = $this->clientConfiguration->provideCompletion; } diff --git a/src/Psalm/Internal/LanguageServer/LanguageServer.php b/src/Psalm/Internal/LanguageServer/LanguageServer.php index 46903da4f..694b1f12b 100644 --- a/src/Psalm/Internal/LanguageServer/LanguageServer.php +++ b/src/Psalm/Internal/LanguageServer/LanguageServer.php @@ -885,7 +885,7 @@ class LanguageServer extends Dispatcher return; } - if ($type < $logLevel) { + if ($type > $logLevel) { return; }