Open mtangoo opened 1 month ago
It looks ok. What php version are you running this with? How is the IDE talking to the LS? stdio or tcp? Are there any errors on the console? I need to check how to run it verbosely. Did the LS attempt to index the root?
Since I don't have much time to develop this project anymore, I suggest you also look at phpactor.
php -v ✹master
PHP 8.3.9 (cli) (built: Jul 2 2024 14:10:14) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.9, Copyright (c) Zend Technologies
with Zend OPcache v8.3.9, Copyright (c), by Zend Technologies
IDE is talking to LS via Sockets so it is TCP/IP. I don't know much about stdio for IPC (would love a good reference if you know any).
Did the LS attempt to index the root?
Can you point a bit how it should be done?
Since I don't have much time to develop this project anymore, I suggest you also look at phpactor.
The LSP seems to be working since your VSCode Plugin works fine. I tried to compare am sending same command for hover as an example but for VS Code it returns response, for mine it doesn't.
Have any idea on how I can debug it at code level? Am not that bad at PHP if I can get starting point.
Thanks for your time
First thing that comes to mind is that the IDE (client) needs to send the initialized notification to LS for LS to start indexing: commit. I don't know how compliant your IDE is, or this LS for that matter...
Regarding debugging. I'm assuming you have control over how php-language-server.php is started and can influence its ENV.
First you need to allow LS to run with Xdebug.
php -v
does not seem to have Xdebug installed, take care of that.bin/php-language-server.php
uses Composer\XdebugHandler\XdebugHandler
to prevent running it under Xdebug. Either comment out $xdebugHandler->check();
or set the env variable PHPLS_ALLOW_XDEBUG=1
that will prevent the script to be restarted without Xdebug.XDEBUG_MODE=debug
and XDEBUG_CONFIG=client_host=127.0.0.1 client_port=9003
and XDEBUG_TRIGGER=1
to start the Xdebug connection. A lot of this can also be setup or can conflict with things in php.iniI'll leave the IDE setup to you, but you can also use vscode-php-debug (that I also maintain). One thing, I would suggest that you use a different debug port as you will be running other PHP processes and the same time and you don't what them to conflict with debugging the LS.
Thanks @zobo for your advice and time. I will check initialized and see if that might be an issue. I will also check XDebug to see how it can help.
One more request, If you have leisure of little bit time, can you point me to file(s) that sends LSP requests (I refer vscode intellisense extension) ? I have little idea on JS/TS, and would like to glean some insights.
Again, thank you for your generosity!
I have this problem that I have no idea what am doing wrong. I have this editor (closed source) that works fine with Serenata, but only symbols (
textDocument/documentSymbol
) works with this LS. If anyone can figure out what am doing wrong, I will be grateful. Hover for example, does not workhere is the hover command which works with Serenata but not with this Lang Server
Here is my initialize JSON-RPC.