php-language-server icon indicating copy to clipboard operation
php-language-server copied to clipboard

Support Doctrine annotations

Open idchlife opened this issue 8 years ago • 15 comments
trafficstars

idchlife avatar Jun 06 '17 11:06 idchlife

Please clarify what you mean with "annotations functionality"

felixfbecker avatar Jun 06 '17 12:06 felixfbecker

@felixfbecker custom annotations, e.g: doctrine annotations (autocomplete, auto import, parameters intellisense etc):

    /**
     *
     * @ORM\Column(type="boolean", options={"default": false})
     * @var
     */
    private $fallback = false;

I actually don't know if this even suppose to be in php server... Because in intellij idea it's separate plugin called "php-annotations".

Trying to switch to vscode from phpstorm, learning which you can and cannot do when comparing both.

idchlife avatar Jun 06 '17 12:06 idchlife

I still don't understand what kind of feature you want from these annotations?

felixfbecker avatar Jun 06 '17 12:06 felixfbecker

As far as I understand, he wants inside these annotations support for the parameters, that we can grab from the definition file.

jens1o avatar Jun 06 '17 12:06 jens1o

@jens1o you are partially right.

@felixfbecker like this (video): https://monosnap.com/file/BEOMmQpvpjaCae4p1Ya2LURr49LqAc

idchlife avatar Jun 06 '17 12:06 idchlife

Is there a standard for this syntax?

felixfbecker avatar Jun 06 '17 12:06 felixfbecker

Also goto definition, since custom annotation is always class, which should be used (e.g.: use App\Annotations\NotNull)

@felixfbecker as far as I know, no. Well, I guess that's why it's separate plugin for phpstorm called "php annotations".

Annotations widely used in Symfony and Doctrine.

I guess issue could be closed now 😞

idchlife avatar Jun 06 '17 13:06 idchlife

This issue shouldn't be dismissed. While not an official standard at the PHP level, Doctrine is one of the most widely used projects in the PHP ecosystem, which makes annotations kind of a de-facto standard.

Of course, actual PHP language support remains more important, but annotations support should be a secondary goal in my opinion.

pmlt avatar Jun 08 '17 12:06 pmlt

I take a look at it as soon as the large pr is merged and I investigated in some other things. It would be interesting wether we have a clean api and there aren't any dialects which would complex it.

jens1o avatar Jun 08 '17 13:06 jens1o

The annotations standard is from PHPDoc if i'm not mistaken.

odahcam avatar Jul 14 '18 14:07 odahcam

Doctrine is very popular ORM but unfortunately there is no support for it in VSCode, is there any package out there to support (syntax highlight and autocomplete) doctrine annotation https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/annotations-reference.html?

Screenshot

yoesoff avatar Nov 10 '19 05:11 yoesoff

Also, annotations are widely used in other libraries (symfony routing)

tomsihap avatar May 27 '20 07:05 tomsihap

I don't know about VSCode packages, but if you really need annotations support, you should take a look on PHP Storm by Jetbrains. Also, this IDE could be a starting point for implementing annotation support here as well.

odahcam avatar May 27 '20 13:05 odahcam

Aren't doctrine style annotations going to be replaced by the upcoming PHP 8 attributes? If this is the case it would seem a little bit pointless to implement support for docblock annotations at this point.

esistgut avatar May 27 '20 13:05 esistgut

Even if it comes to PHP, it will take several months until ship and adoption. I think this issue still valid as long as PHP 8 ins't ready for production, but then this issue dead. I personally can't wait for PHP 8, that looks so damn awesome.

odahcam avatar May 27 '20 13:05 odahcam