File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,11 @@ if exists("loaded_matchup")
21
21
let b: match_skip = ' s:comment\|string'
22
22
endif
23
23
24
- let b: original_commentstring = &l: commentstring
24
+ let b: jsx_pretty_old_cms = &l: commentstring
25
25
26
26
augroup jsx_comment
27
27
autocmd ! CursorMoved <buffer>
28
- autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring (b: original_commentstring )
28
+ autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring (b: jsx_pretty_old_cms )
29
29
augroup end
30
30
31
31
setlocal suffixesadd += .jsx
Original file line number Diff line number Diff line change @@ -18,11 +18,11 @@ if exists("loaded_matchup")
18
18
let b: match_skip = ' s:comment\|string'
19
19
endif
20
20
21
- let b: original_commentstring = &l: commentstring
21
+ let b: jsx_pretty_old_cms = &l: commentstring
22
22
23
23
augroup jsx_comment
24
24
autocmd ! CursorMoved <buffer>
25
- autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring (b: original_commentstring )
25
+ autocmd CursorMoved <buffer> call jsx_pretty#comment#update_commentstring (b: jsx_pretty_old_cms )
26
26
augroup end
27
27
28
28
setlocal suffixesadd += .tsx
Original file line number Diff line number Diff line change 1
1
function ! jsx_pretty#comment#update_commentstring (original)
2
- let syn_current = s: syn_name (line (' .' ), col (' .' ))
3
- let syn_start = s: syn_name (line (' .' ), 1 )
2
+ let line = getline (" ." )
3
+ let col = col (' .' )
4
+ if line !~# ' ^\s*$' && line [: col - 1 ] = ~# ' ^\s*$' " skip indent
5
+ let col = indent (' .' ) + 1
6
+ endif
7
+ let syn_start = s: syn_name (line (' .' ), col )
4
8
let save_cursor = getcurpos ()
5
9
6
10
if syn_start = ~? ' ^jsx'
7
- let line = getline (" ." )
8
- let start = len (matchstr (line , ' ^\s*' ))
9
- let syn_name = s: syn_name (line (' .' ), start + 1 )
10
-
11
11
if line = ~ ' ^\s*//'
12
12
let &l: commentstring = ' // %s'
13
- elseif s: syn_contains (line (' .' ), col ( ' . ' ) , ' jsxTaggedRegion' )
13
+ elseif s: syn_contains (line (' .' ), col , ' jsxTaggedRegion' )
14
14
let &l: commentstring = ' <!-- %s -->'
15
- elseif syn_name = ~? ' ^jsxAttrib'
15
+ elseif syn_start = ~? ' ^jsxAttrib'
16
16
let &l: commentstring = ' // %s'
17
17
else
18
18
let &l: commentstring = ' {/* %s */}'
You can’t perform that action at this time.
0 commit comments