junichi11 / cakephp-netbeans

CakePHP support in NetBeans
http://cakephp.org
71 stars 18 forks source link

Helper alias #49

Closed luke83 closed 11 years ago

luke83 commented 11 years ago

Hi there, thanks for this great netbeans plugin!!!!

A special request: is there a way to have autocomplete for helper alias in view files?

class AppController extends Controller {

public $helpers = array(
            'Html' => array(
                    'className' => 'CustomHtml',
[..]

As general question: is there a way to "inject" specific property autocomplete feature in views? (without touch View class in lib directory of course)

Thanks for time

junichi11 commented 11 years ago

Hi luke83,

You are welcome!

A special request: is there a way to have autocomplete for helper alias in view files?

Probably, It is not available since you are setting helpers to AppController. If you set helpers to concrete controller (e.g. PostsController), code completion will be available (of course, it's OK also alias name). I think that I'll try to implement it as an enhancement because plugin searches only concrete controller now.

As general question: is there a way to "inject" specific property autocomplete feature in views? (without touch View class in lib directory of course)

Currently, plugin provides code completion for helpers and variable with in controller (i.e. $this->set('variable' => 'something'))

If you want to use code completion for your specific variable in View, Please try the following:

Tips

<?php
/* @var $variable MyClass */
$variable;
?>

$variable will be recognized as MyClass.

Thanks, Junichi

luke83 commented 11 years ago

My goal was to have

$this->Html

in the views "autocompleted" by all custom methods in CustomHtml(Helper) class..

Only two options are

Thanks for time and quick response!

junichi11 commented 11 years ago

I see. As I wrote above, I'll try to implement it as an enhancement. But I can't promise that I do it soon... Please wait.

Thanks.

junichi11 commented 11 years ago

I have added your request as new issue ;)

junichi11 commented 11 years ago

Tips

please try to create like the following file:

your project /nbproject/cake_autocomplete.php

<?php
/**
 * For CakePHP Hepler Code Completion
 * ==================================================
 * Helper
 * ==================================================
 * @property CustomHelper $Html
 * @property MySessionHelper $Session
 */
class View{}
luke83 commented 11 years ago

hi there

i tried by adding a new file "cake_autocomplete.php" in /nbproject (is the same folder where is "project.xml", is this correct?) with your code

But when i go in any view file and try $this->[control+space] only property by View class in lib folder are there, no trace of CustomHelper or MySessionHelper!

ps: i have the nbproject folder not in the same project source folder is this relevant?

luke83 commented 11 years ago

ok.. that was the problem.. now it works like a charm!

nbproject was in the wrong tree position.. i re-read the docs :D

junichi11 commented 11 years ago

OK, Perfect!

junichi11 commented 11 years ago

Support for code completion for AppController fields #50