idea-php-symfony2-plugin
idea-php-symfony2-plugin copied to clipboard
Expression Language support
Added support for Expression Language component (https://symfony.com/doc/current/components/expression_language.html)
TODO
- [X] Impl. Parser
- [X] Impl. Syntax Highlighter
- [x] Impl. Syntax Highlighter settings
- [X] Impl. Brace Matcher
- [X] Impl. Quote Handler
Auto inject expression language into:
- [X]
\Symfony\Component\ExpressionLanguage\ExpressionLanguage::{evaluate,compile,parse}
- [x]
\Symfony\Component\ExpressionLanguage\Expression::__construct
- [x] https://symfony.com/doc/current/routing.html#matching-expressions
- [x] ├ Annotation
- [x] ├ Attribute
- [x] ├ PHP
- [x] ├ YAML
- [x] └ XML
- [ ] https://symfony.com/doc/current/reference/constraints/Expression.html
- [x] ├ Annotation
- [x] ├ Attribute
- [x] ├ PHP
- [ ] ├ YAML
- [ ] └ XML
- [ ] ~https://symfony.com/doc/current/reference/twig_reference.html#expression~ Missing PsiLanguageInjectionHost impl. on TwigCompositeElement
- [x] https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/security.html#security
- [x] ├ Annotation
- [x] └ Attribute
- [x] https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/cache.html#http-validation-strategies
- [x] ├ Annotation
- [x] └ Attribute
- [x] https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html#fetch-via-an-expression
- [x] ├ Annotation
- [x] └ Attribute
- [x] https://symfony.com/doc/current/service_container/expression_language.html
- [x] ├ PHP
- [x] ├ YAML
- [x] └ XML
- [ ] ...
Note for reviewers
Expression Language parser
- Implementation is mainly based on https://plugins.jetbrains.com/docs/intellij/custom-language-support-tutorial.html and is placed under
fr.adrienbrault.idea.symfony2plugin.expressionLanguage
package - Expression language lexer & parser are generated from
ExpressionLanguage.bnf
andExpressionLanguage.flex
files as part of the plugin build process using https://github.com/JetBrains/gradle-grammar-kit-plugin - Expression Language grammar is based on https://github.com/JetBrains/Grammar-Kit/blob/master/HOWTO.md#24-compact-expression-parsing-with-priorities
Language Injections
- Deprecated
fr.adrienbrault.idea.symfony2plugin.lang.ParameterLanguageInjector
in favour offr.adrienbrault.idea.symfony2plugin.lang.StringLiteralLanguageInjector
- In compare to previous impl.
StringLiteralLanguageInjector
allows inject language into string literals used in various contexts: Attributes, Annotations, Constructor/Function/Method call argument, Variable assigment and also takes into account named arguments introduced in PHP 8 - Expression Language is injected into YAML/XML files by
YamlLanguageInjector
/XmlLanguageInjector
Links
- https://plugins.jetbrains.com/docs/intellij/custom-language-support-tutorial.html
- https://github.com/JetBrains/Grammar-Kit/blob/master/HOWTO.md#24-compact-expression-parsing-with-priorities
- https://github.com/JetBrains/gradle-grammar-kit-plugin
- https://symfony.com/doc/current/components/expression_language/syntax.html
I had the same idea in mind a while ago. But since it's time consuming i didn't start working on it.
Sounds good! 👍
Is it possible to (auto-)inject it inside DocTags and/or PHP8 attributes?
Thank you for feedback @King2500!
Is it possible to (auto-)inject it inside DocTags and/or PHP8 attributes?
Yes, I think it's possible. I will go through symfony documentation and try identify all possible spots before moving PR from draft to "Ready for review" state.