pycharm-odoo icon indicating copy to clipboard operation
pycharm-odoo copied to clipboard

Type hints for variables in qweb templates

Open trinhanhngoc opened this issue 2 years ago • 0 comments

Hi @jcfernandez-890825 @eselimsen @mrm-david

As you know, type hints help us a lot with code completion, navigation, type checking,... It would be great to have that benefit in XML files as well.

For some templates, it may be possible to simply use passed contexts in controllers (#229). For other templates, we need another way to annotate available variables and its type.

I have been looking for how to do this in other web frameworks, here are the ones I have found so far:

  • Laravel Blade Template: https://blog.jetbrains.com/phpstorm/2017/02/code-completion-in-laravel-blade-templates

  • Twig Template: https://www.jetbrains.com/help/phpstorm/symfony-twig.html#twig-variables

  • Go Template: https://www.jetbrains.com/help/go/integration-with-go-templates.html#define-mapping-of-a-type-between-go-template-and-application

If you have any ideas, suggestions (or imagination ... @jcfernandez-890825), please let me know. Thank you all!

trinhanhngoc avatar Nov 28 '22 08:11 trinhanhngoc