I'm writing a new LSP client, and testing with phpactor. In addition, I'm also testing with Intelephense. In order to support Intelephense, my client passes the following in the initializationOptions
parameter to the initialize
message:
initializationOptions = {
globalStoragePath = "/Users/siegel/path/to/intelephense-storage/global-storage";
storagePath = "/Users/siegel/path/to/intelephense-storage/storage";
};
phpactor doesn't recognize the globalStoragePath
or storagePath
keys, and throws an exception.
(I think there's a sound argument to be made that the names of these two keys are poorly chosen because they're prone to namespace collisions, but it wasn't my decision and I have no influence over Intelephense.)
When these parameters are present, phpactor throws an exception, and then terminates as follows:
2021-05-05 11:53:02.254: stderr output from server: [[0;31mCRIT[0;0m][[1;37m229982.253487[0;0m] Key(s) "storagePath", "globalStoragePath" are not known, known keys: "container.extension_classes", "console_dumper_default", "xdebug_disable", "command", "core.warn_on_develop", "core.min_memory_limit", "class_to_file.project_root", "class_to_file.brute_force_conversion", "code_transform.class_new.variants", "code_transform.template_paths", "code_transform.indentation", "code_transform.refactor.generate_accessor.prefix", "code_transform.refactor.generate_accessor.upper_case_first", "completion_worse.completor.class.limit", "completion_worse.disabled_completors", "completion_worse.name_completion_priority", "completion_worse.snippets", "completion_worse.experimantal", "completion.dedupe", "completion.dedupe_match_short_description", "completion.limit", "navigator.destinations", "navigator.autocreate", "rpc.store_replay", "rpc.replay_path", "source_code_filesystem.project_root", "worse_reflection.enable_cache", "worse_reflection.cache_lifetime", "worse_reflection.enable_context_location", "worse_reflection.cache_dir", "worse_reflection.stub_dir", "file_path_resolver.project_root", "file_path_resolver.app_name", "file_path_resolver.application_root", "file_path_resolver.enable_cache", "file_path_resolver.enable_logging", "logging.enabled", "logging.fingers_crossed", "logging.path", "logging.level", "logger.name", "logging.formatter", "composer.enable", "composer.autoloader_path", "composer.autoload_deregister", "composer.class_maps_only", "console.verbosity", "console.decorated", "extension_manager.extension_vendor_dir", "extension_manager.vendor_dir", "extension_manager.config_path", "extension_manager.extension_list_path", "extension_manager.root_package_name", "extension_manager.minimum_stability", "extension_manager.repositories", "extension_manager.quiet", "worse_reference_finder.plain_text_break_chars", "php.version", "language_server.catch_errors", "language_server.enable_workspace", "language_server.session_parameters", "language_server.method_alias_map", "language_server.diagnostic_sleep_time", "language_server.diagnostics_on_update", "language_server.diagnostics_on_save", "language_server.diagnostic_providers", "language_server,file_events", "language_server.file_event_globs", "language_server_completion.trim_leading_dollar", "language_server_reference_reference_finder.reference_timeout", "language_server_worse_reflection.workspace_index.update_interval", "language_server_code_transform.import_globals", "indexer.enabled_watchers", "indexer.index_path", "indexer.include_patterns", "indexer.exclude_patterns", "indexer.stub_paths", "indexer.poll_time", "indexer.buffer_time", "indexer.project_root", "indexer.reference_finder.deep", "indexer.implementation_finder.deep", "extension_manager.extension_vendor_dir", "extension_manager.vendor_dir", "extension_manager.config_path", "extension_manager.extension_list_path"[]
Exception trace:
at /Users/siegel/git/phpactor/vendor/phpactor/map-resolver/lib/Resolver.php:92
2021-05-05 11:53:02.263: stderr output from server: Phpactor\MapResolver\Resolver->resolve() at /Users/siegel/git/phpactor/vendor/phpactor/language-server-extension/lib/LanguageServer/Dispatcher/PhpactorDispatcherFactory.php:86
Phpactor\Extension\LanguageServer\Dispatcher\PhpactorDispatcherFactory->buildContainer() at /Users/siegel/git/phpactor/vendor/phpactor/language-server-extension/lib/LanguageServer/Dispatcher/PhpactorDispatcherFactory.php:56
Phpactor\Extension\LanguageServer\Dispatcher\PhpactorDispatcherFactory->createContainer() at /Users/siegel/git/phpactor/vendor/phpactor/language-server-extension/lib/LanguageServer/Dispatcher/PhpactorDispatcherFactory.php:33
Phpactor\Extension\LanguageServer\Dispatcher\PhpactorDispatcherFactory->create() at /Users/siegel/git/phpactor/vendor/phpactor/language-server/lib/Core/Server/LanguageServer.php:210
Phpactor\LanguageServer\Core\Server\LanguageServer->Phpactor\LanguageServer\Core\Server\{closure}() at n/a:n/a
Generator->send() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Coroutine.php:118
Amp\Coroutine->Amp\{closure}() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Internal/Placeholder.php:149
Amp\Coroutine->resolve() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Coroutine.php:123
Amp\Coroutine->Amp\{closure}() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Internal/Placeholder.php:149
Amp\Promise@anonymous\/Users/siegel/git/phpactor/vendor/amphp/amp/lib/Deferred.php:22$374->resolve() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Deferred.php:52
Amp\Deferred->resolve() at /Users/siegel/git/phpactor/vendor/amphp/byte-stream/lib/ResourceInputStream.php:109
Amp\ByteStream\ResourceInputStream::Amp\ByteStream\{closure}() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Loop/Driver.php:119
Amp\Loop\Driver->tick() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Loop/Driver.php:72
Amp\Loop\Driver->run() at /Users/siegel/git/phpactor/vendor/amphp/amp/lib/Loop.php:95
Amp\Loop::run() at /Users/siegel/git/phpactor/vendor/phpactor/language-server/lib/Core/Server/LanguageServer.php:113
Phpactor\LanguageServer\Core\Server\LanguageServer->run() at /Users/siegel/git/phpactor/vendor/phpactor/language-server-extension/lib/LanguageServer/Command/StartCommand.php:59
Phpactor\Extension\LanguageServer\Command\StartCommand->execute() at /Users/siegel/git/phpactor/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /Users/siegel/git/phpactor/vendor/symfony/console/Application.php:971
Symfony\Component\Console\Application->doRunCommand() at /Users/siegel/git/phpactor/vendor/symfony/console/Application.php:290
Symfony\Component\Console\Application->doRun() at /Users/siegel/git/phpactor/lib/Application.php:54
Phpactor\Application->doRun() at /Users/siegel/git/phpactor/vendor/symfony/console/Application.php:166
Symfony\Component\Console\Application->run() at /Users/siegel/git/phpactor/bin/phpactor:42
I'd like to propose that while logging unrecognized parameters is a perfectly suitable debugging behavior when -vvv
is specified on the command line, throwing an exception and terminating the server process is probably not the most compatible thing to do for clients.
Would it be possible for phpactor to log (if -vvv
is in effect) and then ignore unrecognized parameter keys (in any message)?