File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+ # name: docstring function
3+ # contributor: Andrea Giugliano
4+ # inspired by a snippet by Tibor Simko et al.
5+ # --
6+ /**
7+ * $1
8+ * ${3:$
9+ (let* ((indent
10+ (concat "\n * "))
11+ (args
12+ (mapconcat
13+ '(lambda (x)
14+ (if (not (string= (nth 0 x) ""))
15+ ;; in Scala I get a separator : for the type
16+ (let ((par-type (mapcar 'string-trim (split-string (nth 0 x) ":")))) (concat "@param " (first par-type) indent "@tparam " (second par-type) indent))
17+ ))
18+ (mapcar
19+ '(lambda (x)
20+ (mapcar
21+ '(lambda (x)
22+ (replace-regexp-in-string "[[:blank:]]*$" ""
23+ (replace-regexp-in-string "^[[:blank:]]*" "" x)))
24+ x))
25+ (mapcar '(lambda (x) (split-string x "="))
26+ (split-string yas-text ",")))
27+ indent)))
28+ (if (string= args "")
29+ (concat indent "@return: " indent "@rtype: " indent (make-string 3 34))
30+ (mapconcat
31+ 'identity
32+ (list "" args )
33+ indent)))
34+ }
35+ * @return ${4:$(yas-text)}
36+ *
37+ **/
38+ def ${2:name}($3): $4 = $0
You can’t perform that action at this time.
0 commit comments