smarty-vscode-support icon indicating copy to clipboard operation
smarty-vscode-support copied to clipboard

Indenting doesn't work for custom functions

Open rickyheijnen opened this issue 4 years ago • 3 comments

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 image

After formatting image

Context (please complete the following information):

  • Version v1.9.0

rickyheijnen avatar Oct 14 '21 12:10 rickyheijnen

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.

DreamerHan avatar Nov 11 '22 07:11 DreamerHan

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

answeb avatar Mar 24 '23 12:03 answeb

@aswinkumar863 could you please add the possibility to configure custom reservated words for identation?

AdmDevSincro avatar Oct 05 '23 03:10 AdmDevSincro