No PHP completion
Describe the bug In Latte files it seems to know the php functions (hovering over an existing php functin shows the doc) but it doesn't complete.
Environment (please complete the following information):
- PhpStorm version 2024.2.1
- Plugin version 1.3.0
To Reproduce
- Install Latte plugin
- Edit .latte file
Code
Hi! {get_the_ID()}
{get_the_title()}
{get_field('test_field')}
<div n:class="test_class">
<p>Test</p>
</div>
{get_
Screenshots
Unfortunately, I don't have the time for adding new features right now, even though this seems relatively easy and useful.
The another problem I see is, that when you start typing {<something>, it's not clear if you want to type function, in most cases when programming in Nette world (where Latte is from) and using best practices, you'll want to create a tag like {if}, {block} and so on, and then you'll see a lot of PHP functions that you would never use in latte, instead of actual blocks, I personally used like 1-2 php functions (formatting ipv6) on huge project for web/vps hosting with a lot of templates.
But I get it that it makes a lot of sense in WordPress ecosystem, where are global functions a backbone of the CMS, but I don't know if adding it is worth it, it depends on how many functions with collide with most common macro names.
Maybe take a look at https://plugins.jetbrains.com/plugin/19661-latte-pro, it's more advanced latte plugin that can even recognize the parameters of the functions and it has better php integration overall, I think autocomplete for functions should be included as well, but I'm not sure and it's paid plugin, but I guess it could be worth the saved time.
I'll consider adding this feature when I'll have the time, or I'll review a PR if someone will create one.
I have decided to add this for functions, it has a special treatment - function has to start with that typed string, so there is less noise when most users want some latte tag in nette framework like {link}. If you want to type class, it has to start with \, like {\Foo