Yep, this is what I've implemented so far. But this way the autocompletion simply shows all classes of the current project, which doesn't really provide contextual information.

If the annotationclasses themselves would allow some way to distinguish them from other
classes, IDEs could provide more useful information to the user:

* Which annotations are available for the current project - including a description ?
* Which parameters does each annotation have - including a description?
* Is a parameter optional or required?
* Add error-markers to annotations with wrong syntax or parameters

All that needs to be done from people who implement annotations is to agree on some common syntax to describe the annotation in the DocBlock of the annotationclass - like the /@method/ and /@property/ annotations in auto-generated Doctrine 1.x classes add hints
to IDEs which methods and properties the class has.


-robert



On 6/8/11 8:44 AM, Johannes Schmitt wrote:
I think the best you can do atm is to simply allow auto completion for classes and add a use statement for the class that is chosen. Just the same autocompletion that eclipse has after the "new" statement, or the "@var" annotation.

Johannes


On Tue, Jun 7, 2011 at 11:23 PM, Christophe COEVOET <s...@notk.org <mailto:s...@notk.org>> wrote:

    Le 07/06/2011 23:07, Robert Gründler a écrit :
    On 6/7/11 10:56 PM, Christophe COEVOET wrote:

    Classes used for annotations depends of the use statement in the
    file and the class name is the annotation name.

    Yes, that's actually the problem ;) I want to provide code
    assistance in an IDE for the annotations, like the one for Java
    annotations.

    Here's an example:

    namespace Acme\DemoBundle\Controller;


    use Symfony\Bundle\FrameworkBundle\Controller\Controller;
    use Symfony\Component\HttpFoundation\RedirectResponse;
    use Acme\DemoBundle\Form\ContactForm;
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;


    class DemoController extends Controller
    {
        /**
         * @Route("/", name="_index")
         * @ <--- *The cursor is here and the IDE wants to provide
    code assistance for the available annotations*
         */
        public function indexAction()
        {
            return array();
        }


    I cannot rely on the "use" statements above to add codehints, as
    only 2 of them are actually annotations: Route + Template.
    The others 3 are "normal" classes. From the IDE's perspective, i
    know that the PHPDocBlock element "@Route" maps to the
    class Sensio\Bundle\FrameworkExtraBundle\Configuration\Route -
    but i have no clue if the class actually represents an annotation.

    So what the IDE has to do is to parse all available classes in
    the project and somehow detect which one of them are annotations
    and which one are not.
    but annotations *are* normal classes which receive the annotations
    parameters as a constructor argument.

-- Christophe | Stof

-- If you want to report a vulnerability issue on symfony, please
    send it to security at symfony-project.com
    <http://symfony-project.com>

    You received this message because you are subscribed to the Google
    Groups "symfony developers" group.
    To post to this group, send email to symfony-devs@googlegroups.com
    <mailto:symfony-devs@googlegroups.com>
    To unsubscribe from this group, send email to
    symfony-devs+unsubscr...@googlegroups.com
    <mailto:symfony-devs%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/symfony-devs?hl=en


--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

--
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to