summaryrefslogtreecommitdiffstats
path: root/indent/typescript.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2015-10-10 16:56:22 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2015-10-10 16:56:22 +0200
commit0de043adbc144510635702dadedc946e3c69f64e (patch)
tree78e5d363305935cf5653a3f510ab86bb019c3199 /indent/typescript.vim
parent67fcbd2a8632d5ab7895e34acb084117e5d0ea17 (diff)
downloadvim-polyglot-0de043adbc144510635702dadedc946e3c69f64e.tar.gz
vim-polyglot-0de043adbc144510635702dadedc946e3c69f64e.zip
Update
Diffstat (limited to 'indent/typescript.vim')
-rw-r--r--indent/typescript.vim18
1 files changed, 15 insertions, 3 deletions
diff --git a/indent/typescript.vim b/indent/typescript.vim
index 73bce658..58dc7d03 100644
--- a/indent/typescript.vim
+++ b/indent/typescript.vim
@@ -60,9 +60,21 @@ function GetTypescriptIndent()
return indent(prev)
endif
- " If a variable was declared and the semicolon omitted, do not indent
- " the next line
- if getline(prev) =~ '^\s*var\s\+\w\+'
+ " If the previous line starts with '@', we should have the same indent as
+ " the previous one
+ if getline(prev) =~ '^\s*@\S\+\s*$'
+ return indent(prev)
+ endif
+
+ " If a var, let, or const was declared and the semicolon omitted, do not
+ " indent the next line
+ if getline(prev) =~ '^\s*\(var\|let\|const\)\s\+\w\+'
+ return indent(prev)
+ endif
+
+ " If the line ended with a ',', we should have the same indent as
+ " the previous one
+ if getline(prev) =~ ',\s*$'
return indent(prev)
endif