@@ -44,18 +44,30 @@ function! s:readtmpl(type)
4444 return tmpl
4545endfunction
4646
47+ function ! s: parseClass (line )
48+ " For class definition, we just simply need to extract the class name. We can
49+ " do that by just delete every white spaces and the whole parenthesics if
50+ " existed.
51+ let header = substitute (a: line , ' \s\|(.*\|:' , ' ' , ' g' )
52+ let parse = {' type' : ' class' , ' header' : header, ' args' : ' ' }
53+ return parse
54+ endfunction
55+
4756function ! s: parse (line )
4857 let str = substitute (a: line , ' \\' , ' ' , ' g' )
4958 let type = ' '
59+
60+ if str = ~ s: regexs [' class' ]
61+ let str = substitute (str, s: regexs [' class' ], ' ' , ' ' )
62+ return s: parseClass (str)
63+ endif
64+
5065 if str = ~ s: regexs [' def' ]
5166 let str = substitute (str, s: regexs [' def' ], ' ' , ' ' )
5267 let type = ' def'
5368 elseif str = ~ s: regexs [' async' ]
5469 let str = substitute (str, s: regexs [' async' ], ' ' , ' ' )
5570 let type = ' def'
56- elseif str = ~ s: regexs [' class' ]
57- let str = substitute (str, s: regexs [' class' ], ' ' , ' ' )
58- let type = ' class'
5971 else
6072 return 0
6173 endif
@@ -85,6 +97,7 @@ function! s:builddocstring(strs, indent, nested_indent)
8597 let type = a: strs [' type' ]
8698 let prefix = a: strs [' header' ]
8799 let args = a: strs [' args' ]
100+
88101 let tmpl = ' '
89102 if len (args ) > 0 && type == ' def'
90103 let docstrings = []
0 commit comments