felixfbecker / php-language-server

PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥
ISC License
1.15k stars 185 forks source link

Replace phpDocumentor/reflection-docblock #163

Open felixfbecker opened 7 years ago

felixfbecker commented 7 years ago

reflection-docblock does not support generics and probably never will. Also, we have no positional info of the tags, which makes https://github.com/felixfbecker/php-language-server/issues/134 impossible. I'm thinking about forking and adding support for various things, while trying to merge the upstream in every once in a while.

felixfbecker commented 7 years ago

https://github.com/etsy/phan/blob/master/src/Phan/Language/Type.php

felixfbecker commented 7 years ago

https://github.com/etsy/phan/issues/408

mindplay-dk commented 7 years ago

@felixfbecker I just came across this, check it out:

https://github.com/vaniocz/type-parser

Appears to have just what you're looking for in a single, stand-alone package.

Even appears to parse generic syntax.

mindplay-dk commented 7 years ago

Did you get a chance to look at this lib?

I looked into it a bit, I actually poked through your code for a few hours the other night to see how this would fit, but, well, it's a big project - I don't fully understand how precisely it all works yet.

I got the impression that types from phpDocumentor are pretty integral to the current state of the codebase, and maybe replacing it with this lib isn't exactly a small operation?

Looks like this lib does only the type parsing as such, it doesn't seem to do things like tyoe-compatibility checks, so I'm guessing a lot of that would need to be refactored to integrate this lib - it does look like this lib would need to replace (some of) the phpDocumentor components, I don't think integrating it side-by-side with the phpDocumentor stuff looks feasible?

On a separate topic, have you thought about kickstarting this project or something? It looks like you have a really solid foundation with the event-loop and all - I don't think any of the other projects (phan, phpstan, ...) have that. I think phan is (was?) working on something, but your architecture was designed for efficient real-time analysis from the ground up, so it can probably do this much more efficiently. You also designed with the MS language server API from the start, so your project can integrate easily with editors and likely more IDEs in the future. And it's written in PHP, which gives you another huge advantage over PhpStorm which was written in Java - potential contributions from the PHP community. I think these factors give your project a huge advantage over basically everything else - and I mean, we pay money for PhpStorm, and with a little work, this project could beat PhpStorm's level of PHP support. Generics, for one, would be huge in my world. Personally, I'd much rather put $120/year into this than into PhpStorm...