Skip to content

Commit 6a28fa6

Browse files
dkwon17fbricon
authored andcommitted
Fix bad indentation issue
Fixes #137 Signed-off-by: David Kwon <dakwon@redhat.com>
1 parent eb726d6 commit 6a28fa6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/extension.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,13 @@ function getScopeLevel(configurationKey : string, key : string) : ScopeInfo{
212212

213213
function getIndentationRules(): LanguageConfiguration {
214214
return {
215+
216+
// indentationRules referenced from:
217+
// https://github.com/microsoft/vscode/blob/d00558037359acceea329e718036c19625f91a1a/extensions/html-language-features/client/src/htmlMain.ts#L114-L115
218+
indentationRules: {
219+
increaseIndentPattern: /<([-_\.A-Za-z0-9]+)(?=\s|>)\b[^>]*>(?!.*<\/\1>)|<!--(?!.*-->)|\{[^}"']*$/,
220+
decreaseIndentPattern: /^\s*(<\/[-_\.A-Za-z0-9]+\b[^>]*>|-->|\})/
221+
},
215222
onEnterRules: [
216223
{
217224
beforeText: new RegExp(`<([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`, 'i'),

0 commit comments

Comments
 (0)