smarty-vscode-support
smarty-vscode-support copied to clipboard
Indenting doesn't work for custom functions
Describe the bug When using the format document function, it doesn't keep the indenting of my custom functions. Indents of Smarty default functions such as {if} {foreach} or {for} are nicely formatted. But I have many custom functions like {tabset} or {tab} and their indent keeps being removed by Format document.
Screenshots
Before formatting

After formatting

Context (please complete the following information):
- Version v1.9.0
This is reproduced here for me as well. But I don't think it's a bug. I've found that there is no problem if using smarty's native delimiter {} indentation, it only happens with custom tags or custom delimiters. I strongly hope that the author can add custom delimiters. For example, my current project delimiter is {%%}. This project is very old, and it will be a big project to modify the delimiter.
I have a similar issue, I use {t}text{/t} to mark translatable strings, but the formatter breaks things up :
<div class="callout secondary">{t}No records found{/t}</div>
becomes
<div class="callout secondary">{t}No records found {/t}</div>
It is a big problem because now the translation string has a \n at the end, and it cannot be found anymore. Would be nice if we could have a blacklist for specific functions, or at least doesn't try to format unknown functions ...
@aswinkumar863 could you please add the possibility to configure custom reservated words for identation?