From 468e7e7d457c41093d97023d17a5d4df02f94a49 Mon Sep 17 00:00:00 2001 From: Andrew Nagy Date: Thu, 26 Jan 2023 09:12:43 +0000 Subject: [PATCH] add cli command to turn off xdebug turnoff functionality, fix bug with docblock --- src/Psalm/Internal/Cli/LanguageServer.php | 14 ++++++++++++-- .../LanguageServer/Server/TextDocument.php | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Cli/LanguageServer.php b/src/Psalm/Internal/Cli/LanguageServer.php index 88f36b41d..4813bbc59 100644 --- a/src/Psalm/Internal/Cli/LanguageServer.php +++ b/src/Psalm/Internal/Cli/LanguageServer.php @@ -90,6 +90,7 @@ final class LanguageServer 'enable-provide-signature-help::', 'enable-provide-definition::', 'show-diagnostic-warnings::', + 'disable-xdebug::', 'on-change-debounce-ms::', 'use-extended-diagnostic-codes', 'verbose', @@ -222,6 +223,9 @@ final class LanguageServer --on-change-debounce-ms=[INT] The number of milliseconds to debounce onChange events. + --disable-xdebug[=BOOL] + Disable xdebug for performance reasons. Enable for debugging + --verbose Will send log messages to the client with information. @@ -275,8 +279,14 @@ final class LanguageServer $ini_handler->disableExtension('grpc'); - // If Xdebug is enabled, restart without it - $ini_handler->check(); + $diableXdebug = !isset($options['disable-xdebug']) + || !is_string($options['disable-xdebug']) + || strtolower($options['disable-xdebug']) !== 'false'; + + // If Xdebug is enabled, restart without it based on cli + if ($diableXdebug) { + $ini_handler->check(); + } setlocale(LC_CTYPE, 'C'); diff --git a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php index 35e8afbf0..309680c66 100644 --- a/src/Psalm/Internal/LanguageServer/Server/TextDocument.php +++ b/src/Psalm/Internal/LanguageServer/Server/TextDocument.php @@ -109,6 +109,7 @@ class TextDocument /** * The document change notification is sent from the client to the server to signal changes to a text document. * + * @param VersionedTextDocumentIdentifier $textDocument * @param TextDocumentContentChangeEvent[] $contentChanges */ public function didChange(VersionedTextDocumentIdentifier $textDocument, array $contentChanges): void