HvyIndustries / crane

PHP Intellisense/code-completion for VS Code
https://hvy.io/crane
Other
240 stars 25 forks source link

Padawan.php integration? #65

Open girvo opened 8 years ago

girvo commented 8 years ago

Hey there, lovely work on Crane, very impressive!

There's an interesting autocomplete server for PHP (written in PHP, using nikic/php-parser internally for it to statically analyse code) for Composer-based projects, called padawan.php: https://github.com/mkusher/padawan.php

I wonder if leveraging it would help, as it pretty much implements the features that you'd like to implement but doesn't implement the features you already have, which is quite interesting (and useful). Effectively leveraging it as a powerful typehint- and DocBlock-aware autocomplete provider in addition to your server?

I'm going to take a look at implementing Padawan as an extension to Visual Studio: Code in it's own right, to see how difficult it will be, but I don't foresee too many dramas. Would love your input on it!

nevadascout commented 8 years ago

Hey, thanks!

I hadn't heard of Padawan, but I am aware of nikic's php-parser library. I was originally going to use that as the parser base for Crane, but I didn't want having PHP installed to be a dependency of the extension.

I'll definitely have a look to see how they're doing the docblocks and typehinting and possibly contribute them back into the JS php parser that we're using so that we can benefit from those great features.

Longer term, I want to write our own parser in Typescript, but that's a long way off.

Good luck with your VS Code extension! The open-source Go extension for VS Code could be a good place to start to see how that integrates with a separate binary for code completion.

Here's an example of how they find references for a symbol.

If you want any help or just someone to bounce an idea off, let me know.

Ciantic commented 8 years ago

I didn't want having PHP installed to be a dependency of the extension.

@nevadascout the VS Code already requires a PHP executable to be available for linting, there is the property:

"php.validate.executablePath": ".../php.exe"

I think it's reasonable to assume that those who want to use PHP in vscode would have php executable on their computer and are willing to fill that config which is provided by vscode.

Focusing efforts to single language server would be good. Padawan seems like a better alternative because it's written in PHP. (And arguably it's easier to get people working on a code base for PHP tools that are written in PHP)