vscode-twig-language-2 icon indicating copy to clipboard operation
vscode-twig-language-2 copied to clipboard

Auto-indent

Open paulmist opened this issue 4 years ago • 6 comments

The auto-indent (on return between brackets) present in HTML files in VSCode isn't functioning in Twig files.

paulmist avatar Mar 03 '20 16:03 paulmist

Definitely don't know what I'm doing but perhaps it requires some "indentationRules" in the language config like this? (Stolen from the PHP language config):

"indentationRules": {
		"increaseIndentPattern": "({(?!.*}).*|\\(|\\[|((else(\\s)?)?if|else|for(each)?|while|switch|case).*:)\\s*((/[/*].*|)?$|\\?>)",
		"decreaseIndentPattern": "^(.*\\*\\/)?\\s*((\\})|(\\)+[;,])|(\\][;,])|\\b(else:)|\\b((end(if|for(each)?|while|switch)|break);))"
	},

paulmist avatar Mar 03 '20 21:03 paulmist

https://code.visualstudio.com/api/language-extensions/language-configuration-guide#indentation-rules

paulmist avatar Mar 04 '20 09:03 paulmist

I've attempted to add this myself in a fork of the extension - but no luck. Any help appreciated.

paulmist avatar Mar 17 '20 10:03 paulmist

I'm also noticing this issue as well, with no luck resolving.

devrsw avatar Apr 06 '20 15:04 devrsw

Is this the same problem as #16?

It's been driving me around the bend, I ended up going for the Twig extension by whatwedo. It doesn't appear to be as good but the indents work.

RyanRoberts avatar Apr 06 '20 15:04 RyanRoberts

This issue is bothering me too, found no workaround or fix.

markmacode avatar Apr 06 '20 22:04 markmacode