11" File: jsdoc.vim
22" Author: NAKAMURA, Hisashi <https://github.com/sunvisor>
33" Modifyed: Shinya Ohyanagi <sohyanagi@gmail.com>
4- " Version: 0.11.0
4+ " Version: 0.11.1
55" WebPage: http://github.com/heavenshell/vim-jsdoc/
66" Description: Generate JSDoc to your JavaScript file.
77" License: BSD, see LICENSE for more details.
@@ -108,6 +108,7 @@ let s:regexs = {
108108 \ ' shorthand' : ' ^.\{-}\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*(\s*\([^)]*\)\s*).*$' ,
109109 \ ' static' : ' ^.\{-}\s*static\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*(\s*\([^)]*\)\s*).*$' ,
110110 \ ' arrow' : ' ^.\{-}\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*[:=]\s*(\s*\([^)]*\)\s*)\s*=>.*$' ,
111+ \ ' arrow_single' : ' ^.\{-}\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\)\s*[:=]\s*\([^=]*\).*$' ,
111112 \ ' return_type' : ' )\(:\|:\s\|\s*:\s*\)\([a-zA-Z]\+\).*$' ,
112113 \ ' interface' : ' ^.\{-}\s*interface\s*\([a-zA-Z_$][a-zA-Z0-9_$]*\).*$' ,
113114 \ ' access' : ' ^\s*\(public\|protected\|private\)' ,
@@ -125,7 +126,7 @@ function! s:parse_type(args)
125126 for arg in a: args
126127 if arg = ~# ' :'
127128 let args = split (arg, ' :' )
128- let val = args [0 ]
129+ let val = s: trim ( args [0 ])
129130 if val = ~# s: regexs [' access' ]
130131 let val = s: trim (split (val, s: regexs [' access' ])[0 ])
131132 endif
@@ -137,7 +138,7 @@ function! s:parse_type(args)
137138 endif
138139 call add (results, {' val' : val, ' type' : type })
139140 else
140- call add (results, {' val' : arg, ' type' : ' ' })
141+ call add (results, {' val' : s: trim ( arg) , ' type' : ' ' })
141142 endif
142143 endfor
143144
@@ -262,6 +263,10 @@ function! s:determine_style(line)
262263 let l: is_function = 1
263264 let l: is_named = 1
264265 let l: regex = s: regexs [' arrow' ]
266+ elseif g: jsdoc_enable_es6 == 1 && a: line = ~ s: regexs [' arrow_single' ]
267+ let l: is_function = 1
268+ let l: is_named = 1
269+ let l: regex = s: regexs [' arrow_single' ]
265270 elseif g: jsdoc_enable_es6 == 1 && a: line = ~ s: regexs [' class_extend' ]
266271 let l: is_class = 1
267272 let l: is_named = 1
0 commit comments