mirror of
https://github.com/danog/psalm.git
synced 2024-12-04 10:38:49 +01:00
allow dynamically changing configuration without restarting
This commit is contained in:
parent
468e7e7d45
commit
3c38e02b62
@ -45,7 +45,7 @@ class ClientConfiguration
|
|||||||
/**
|
/**
|
||||||
* Provide Hover Requests or not
|
* Provide Hover Requests or not
|
||||||
*/
|
*/
|
||||||
public ?bool $provideHover= null;
|
public ?bool $provideHover = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide Signature Help or not
|
* Provide Signature Help or not
|
||||||
|
@ -11,6 +11,8 @@ use Psalm\Internal\LanguageServer\Client\TextDocument as ClientTextDocument;
|
|||||||
use Psalm\Internal\LanguageServer\Client\Workspace as ClientWorkspace;
|
use Psalm\Internal\LanguageServer\Client\Workspace as ClientWorkspace;
|
||||||
|
|
||||||
use function is_null;
|
use function is_null;
|
||||||
|
use function json_decode;
|
||||||
|
use function json_encode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
@ -144,8 +146,39 @@ class LanguageClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_null($this->clientConfiguration->provideCompletion)) {
|
/** @var array */
|
||||||
//$this->server->project_analyzer->provide_completion = $this->clientConfiguration->provideCompletion;
|
$array = json_decode(json_encode($config), true);
|
||||||
|
|
||||||
|
if (isset($array['hideWarnings'])) {
|
||||||
|
$this->clientConfiguration->hideWarnings = (bool) $array['hideWarnings'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['provideCompletion'])) {
|
||||||
|
$this->clientConfiguration->provideCompletion = (bool) $array['provideCompletion'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['provideDefinition'])) {
|
||||||
|
$this->clientConfiguration->provideDefinition = (bool) $array['provideDefinition'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['provideHover'])) {
|
||||||
|
$this->clientConfiguration->provideHover = (bool) $array['provideHover'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['provideSignatureHelp'])) {
|
||||||
|
$this->clientConfiguration->provideSignatureHelp = (bool) $array['provideSignatureHelp'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['provideCodeActions'])) {
|
||||||
|
$this->clientConfiguration->provideCodeActions = (bool) $array['provideCodeActions'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['provideDiagnostics'])) {
|
||||||
|
$this->clientConfiguration->provideDiagnostics = (bool) $array['provideDiagnostics'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($array['findUnusedVariables'])) {
|
||||||
|
$this->clientConfiguration->findUnusedVariables = (bool) $array['findUnusedVariables'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,8 @@ class LanguageServer extends Dispatcher
|
|||||||
*/
|
*/
|
||||||
public ?ServerWorkspace $workspace = null;
|
public ?ServerWorkspace $workspace = null;
|
||||||
|
|
||||||
|
public ?ClientInfo $clientInfo = null;
|
||||||
|
|
||||||
protected ProtocolReader $protocolReader;
|
protected ProtocolReader $protocolReader;
|
||||||
|
|
||||||
protected ProtocolWriter $protocolWriter;
|
protected ProtocolWriter $protocolWriter;
|
||||||
@ -426,6 +428,7 @@ class LanguageServer extends Dispatcher
|
|||||||
?string $trace = null
|
?string $trace = null
|
||||||
//?array $workspaceFolders = null //error in json-dispatcher
|
//?array $workspaceFolders = null //error in json-dispatcher
|
||||||
): Promise {
|
): Promise {
|
||||||
|
$this->clientInfo = $clientInfo;
|
||||||
$this->clientCapabilities = $capabilities;
|
$this->clientCapabilities = $capabilities;
|
||||||
$this->trace = $trace;
|
$this->trace = $trace;
|
||||||
return call(
|
return call(
|
||||||
|
Loading…
Reference in New Issue
Block a user