From 16aa8c93dd2187ca64417b95137b3083568b379f Mon Sep 17 00:00:00 2001 From: Colin Mollenhour Date: Thu, 14 Aug 2025 03:56:37 -0400 Subject: [PATCH] Support license key for advanced PHP LSP features. (#476) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add optional Intelephense license key support via INTELEPHENSE_LICENSE_KEY environment variable - Add initializationOptions support to Intelephense LSP server - Pass license key via licenceKey property when environment variable is set - Update README.md and DOCKER.md documentation with new environment variable - Fix docstring comment in _get_initialize_params method 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude * Fix formatting --------- Co-authored-by: Claude --- DOCKER.md | 1 + README.md | 2 +- src/solidlsp/language_servers/intelephense.py | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/DOCKER.md b/DOCKER.md index e2647503..84f8f746 100644 --- a/DOCKER.md +++ b/DOCKER.md @@ -125,6 +125,7 @@ volumes: - `SERENA_DOCKER=1`: Set automatically to indicate Docker environment - `SERENA_PORT`: MCP server port (default: 9121) - `SERENA_DASHBOARD_PORT`: Web dashboard port (default: 24282) +- `INTELEPHENSE_LICENSE_KEY`: License key for Intelephense PHP LSP premium features (optional) ## Troubleshooting diff --git a/README.md b/README.md index 3759b771..d362ade6 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ With Serena, we provide * direct, out-of-the-box support for: * Python * TypeScript/Javascript - * PHP + * PHP (uses Intelephense LSP; set `INTELEPHENSE_LICENSE_KEY` environment variable for premium features) * Go (requires installation of gopls) * Rust * C# diff --git a/src/solidlsp/language_servers/intelephense.py b/src/solidlsp/language_servers/intelephense.py index 2d1d48e2..ee3a61b9 100644 --- a/src/solidlsp/language_servers/intelephense.py +++ b/src/solidlsp/language_servers/intelephense.py @@ -101,7 +101,7 @@ class Intelephense(SolidLanguageServer): @staticmethod def _get_initialize_params(repository_absolute_path: str) -> InitializeParams: """ - Returns the initialize params for the TypeScript Language Server. + Returns the initialize params for the Intelephense Language Server. """ root_uri = pathlib.Path(repository_absolute_path).as_uri() initialize_params = { @@ -124,6 +124,11 @@ class Intelephense(SolidLanguageServer): ], } + # Add license key if provided via environment variable + license_key = os.environ.get("INTELEPHENSE_LICENSE_KEY") + if license_key: + initialize_params["initializationOptions"] = {"licenceKey": license_key} + return initialize_params def _start_server(self):