atom-autocomplete-php icon indicating copy to clipboard operation
atom-autocomplete-php copied to clipboard

Idea - Framework detection/integration

Open alexandernst opened this issue 9 years ago • 5 comments

After discussing what is failing with Yii2 here I started trying different combinations of settings and I discovered that adding vendor/yiisoft/yii2/Yii.php to the "Autoloader file" path in the settings and

"autoload": {
    "psr-4": {
        "": ["controllers/", "models/"]
    }
},

to my composer.json file I can get autocomplete working with Yii2.

Then I got an idea. What if this plugin could try to detect (based on the structure of the folders of the project, content of the composer.json file, etc) if the current project is a "known" framework, and if so, suggest some recommended settings (maybe even give the user the ability to apply them with a single click?). That would improve the UX by far and it will make using this plugin a lot easier.

alexandernst avatar Sep 26 '15 01:09 alexandernst

I don't know how Peekmo feels about this, but it might be a good idea to add a wiki regarding how to set up the Yii framework for autocompletion. The README could then just provide a link to the wiki. This is not entirely what you're requesting, but this wouldn't be much work (in fact you can just add the wiki entry yourself) and offer a minimum of information until a better solution is actually implemented, the latter which could take some time, seeing as there are still quite some bugs to squash or features to enhance.

ghost avatar Sep 26 '15 08:09 ghost

Hello,

I'm happy that you finally make it works for Yii2. Your suggestion is not that bad, I want to make a framework support, but it will need contributors from all those frameworks, because I just know Symfony2 and Silex, and I will not learn every frameworks specificities, just for a plugin ^^

However, for Yii2, you need to modify the composer.json, and this will never be done by the plugin, because it will never modified user's source code, so, Yii2 can't be handled programmatically. Adding an entry for Yii2 in a wiki could be, in fact, a better idea.

Regards, Peekmo

Peekmo avatar Sep 27 '15 07:09 Peekmo

Yes, it would be a bad idea to modify user's files. What I was suggesting is to modify the plugin settings (adding the required autoloader file paths) and if further changes are required, show a popup (or any other message of some kind) explaining them.

Maybe this feature could fetch the actual texts from the wiki, so that would make it easier to add/modify frameworks.

alexandernst avatar Sep 27 '15 11:09 alexandernst

Or just a notice that tells "You're on a Yii2 project, please, see the informations from the wiki (link) to find the right way to configure the plugin and your project"

Peekmo avatar Sep 29 '15 07:09 Peekmo

@alexandernst @Peekmo what if, when a Framework is detected, an "internal" autoload.php file is generated for it and included in the "autoloadPaths". That file file not have to be in the user's repo, it could be stored somewhere in atom's config folder or something... That way, there is no need to modify the composer.json file, right?

I don't feel too comfortable editing the composer.json and have that change in my repo just to make this plugin work...

bboure avatar May 17 '17 08:05 bboure