HvyIndustries/crane

Collaborate on php-language-server

felixfbecker opened this issue · 5 comments

I wanted to inform you that I implemented the Language Server Protocol in PHP. It is available as a composer package and can therefor in theory be used by any IDE. The parsing is done by https://github.com/nikic/PHP-Parser (which is the parser used by phpDocumentor and many others) and the JSON-RPC protocol parsing/dispatching is working correctly, only the actual implementations are missing.

I am very open to contributions if you want to combine efforts on that project instead, as I feel it is built on a more robust fundament.

https://github.com/felixfbecker/vscode-php-intellisense
https://github.com/felixfbecker/php-language-server
https://github.com/felixfbecker/php-advanced-json-rpc

(I am also the author of https://github.com/felixfbecker/vscode-php-debug)

Hi Felix, thanks for the invitation to collaborate!
I (and other people in my office) use the php debug extension you've written for VS Code.

I accept your point about Nikita's PHP-Parser library (which is indeed a very stable and robust base), however I didn't want having PHP being installed to be a dependency of the VS Code plugin. I've run afoul of atom plugins in the past that are quite complex to set up and wanted mine to "just work" after clicking "install".

I wish you the best with your project, and I may make some contributions to it in the future (you already have some very desirable features that I want/need!)

Thanks for the response! I see your point, "works out of the box" is nice to have. I think though that PHP developers will generally have PHP installed. I think it attracts more contributions though, because PHP developers don't necessarily know TypeScript or Node. You did a great job with crane and of course you are invited to contribute, as you probably figured out a lot of the IntelliSense, just in a different language. Just wanted to drop a note :)

Sorry it took so long to respond!

I think though that PHP developers will generally have PHP installed.

This is normally true, however at work (where I mainly created Crane for) we use Vagrant to run development environments so we don't actually have PHP installed locally, and being on windows it's a bit of a hassle to install the (older) version that we develop on.

You're certainly right about contributors, you seem to have had more in the space of time that you've had your project up than I have since I created mine!

@nevadascout Standalone PHP (as opposed to an *AMP stack) can be installed portably in a single folder on Windows. You just need to unzip a folder-ful of binaries to a particular location. This means a platform-appropriate sandboxed PHP could hypothetically be downloaded by the extension for maximum "works out of the box"-ness. Of course downloading PHP and putting it on your PATH on Windows isn't that hard either: choco install php.

The reason I'm playing devil's advocate here is because the TypeScript approach will be more limited when it comes to advanced extension features, and also because I'm greedy and want the autocomplete functionality of this extension alongside the code analysis of the other.

Nevertheless, thank you both for your awesome work on this. Two extensions are certainly better than none.

I was going to open the same discussion, glad to see @felixfbecker opened Pandora's box.

I'm using VSCode since day 1, I loved it for the extreme lightness & I missed PHP IntelliSense as a fat kid misses candy. Two days ago I found out I have no reason to keep NetBeans installed anymore, after months of waiting for Microsoft to add the extension API and waiting for somebody to write a language server for PHP.

To be honest, I was expecting the core team to give more attention to PHP developers community, but well, life is not perfect, and now I found out that there are 2 extensions for us...

From a technological point of view, OFC it makes sense to have a dedicated language server (even tho I was reticent at the beginning) instead of using TypeScript LS (intended for JavaScript).

From a features point of view, your joined efforts (under any form) would better serve the community, instead of creating confusion for developers. I myself had the opinion that PHP support is bad in VSCode and both extensions are incomplete, preventing mass adoption.

I would strongly advise HvyIndustries reconsiders. Thank you!