diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-04-14 13:17:26 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-04-14 13:17:26 +0200 |
commit | 14dc82fc4e6c0c08078f97a24a6c1639c1cc5113 (patch) | |
tree | dea8d2398a9377a0eee7786776e3cd420ce1ee89 /autoload/jsx_pretty | |
parent | e86e0ad36ef9501acbc3e8c63a1d4fab104e47cb (diff) | |
download | vim-polyglot-14dc82fc4e6c0c08078f97a24a6c1639c1cc5113.tar.gz vim-polyglot-14dc82fc4e6c0c08078f97a24a6c1639c1cc5113.zip |
Update
Diffstat (limited to 'autoload/jsx_pretty')
-rw-r--r-- | autoload/jsx_pretty/comment.vim | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/autoload/jsx_pretty/comment.vim b/autoload/jsx_pretty/comment.vim index c202ebf4..98eab5e3 100644 --- a/autoload/jsx_pretty/comment.vim +++ b/autoload/jsx_pretty/comment.vim @@ -1,20 +1,20 @@ if !exists('g:polyglot_disabled') || !(index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'typescript') != -1 || index(g:polyglot_disabled, 'jsx') != -1) function! jsx_pretty#comment#update_commentstring(original) - let syn_current = s:syn_name(line('.'), col('.')) - let syn_start = s:syn_name(line('.'), 1) + let line = getline(".") + let col = col('.') + if line !~# '^\s*$' && line[: col - 1] =~# '^\s*$' " skip indent + let col = indent('.') + 1 + endif + let syn_start = s:syn_name(line('.'), col) let save_cursor = getcurpos() if syn_start =~? '^jsx' - let line = getline(".") - let start = len(matchstr(line, '^\s*')) - let syn_name = s:syn_name(line('.'), start + 1) - if line =~ '^\s*//' let &l:commentstring = '// %s' - elseif s:syn_contains(line('.'), col('.'), 'jsxTaggedRegion') + elseif s:syn_contains(line('.'), col, 'jsxTaggedRegion') let &l:commentstring = '<!-- %s -->' - elseif syn_name =~? '^jsxAttrib' + elseif syn_start =~? '^jsxAttrib' let &l:commentstring = '// %s' else let &l:commentstring = '{/* %s */}' |