felixfbecker / php-language-server

PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥
ISC License
1.15k stars 185 forks source link

Support Doctrine annotations #383

Open idchlife opened 7 years ago

felixfbecker commented 7 years ago

Please clarify what you mean with "annotations functionality"

idchlife commented 7 years ago

@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.

felixfbecker commented 7 years ago

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

jens1o commented 7 years ago

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

idchlife commented 7 years ago

@jens1o you are partially right.

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

felixfbecker commented 7 years ago

Is there a standard for this syntax?

idchlife commented 7 years ago

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 😞

pmlt commented 7 years ago

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.

jens1o commented 7 years ago

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.

odahcam commented 6 years ago

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

yoesoff commented 4 years ago

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

tomsihap commented 4 years ago

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

odahcam commented 4 years ago

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.

esistgut commented 4 years ago

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.

odahcam commented 4 years ago

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.