File tree Expand file tree Collapse file tree 4 files changed +84
-6
lines changed Expand file tree Collapse file tree 4 files changed +84
-6
lines changed Original file line number Diff line number Diff line change
1
+ " File: jsdoc.vim
2
+ " Author: NAKAMURA, Hisashi <https://github.com/sunvisor>
3
+ " Author: Shinya Ohyanagi <sohyanagi@gmail.com>
4
+ " Version: 2.1.4
5
+ " WebPage: http://github.com/heavenshell/vim-jsdoc/
6
+ " Description: Generate JSDoc to your JavaScript, TypeScript file.
7
+ " License: BSD, see LICENSE for more details.
8
+ let s: save_cpo = &cpo
9
+ set cpo &vim
10
+
11
+ " version check
12
+ if ! has (' nvim' ) && (! has (' channel' ) || ! has (' job' ))
13
+ echoerr ' +channel and +job are required for jsdoc.vim'
14
+ finish
15
+ endif
16
+
17
+ command ! -range =0 JsDoc call jsdoc#insert (<q-args> , <count> , <line1> , <line2> )
18
+ command ! JsDocFormat call jsdoc#format ()
19
+ nnoremap <silent> <buffer> <Plug> (jsdoc) :call jsdoc#insert()<CR>
20
+
21
+ let &cpo = s: save_cpo
22
+ unlet s: save_cpo
Original file line number Diff line number Diff line change
1
+ " File: jsdoc.vim
2
+ " Author: NAKAMURA, Hisashi <https://github.com/sunvisor>
3
+ " Author: Shinya Ohyanagi <sohyanagi@gmail.com>
4
+ " Version: 2.1.4
5
+ " WebPage: http://github.com/heavenshell/vim-jsdoc/
6
+ " Description: Generate JSDoc to your JavaScript, TypeScript file.
7
+ " License: BSD, see LICENSE for more details.
8
+ let s: save_cpo = &cpo
9
+ set cpo &vim
10
+
11
+ " version check
12
+ if ! has (' nvim' ) && (! has (' channel' ) || ! has (' job' ))
13
+ echoerr ' +channel and +job are required for jsdoc.vim'
14
+ finish
15
+ endif
16
+
17
+ command ! -range =0 JsDoc call jsdoc#insert (<q-args> , <count> , <line1> , <line2> )
18
+ command ! JsDocFormat call jsdoc#format ()
19
+ nnoremap <silent> <buffer> <Plug> (jsdoc) :call jsdoc#insert()<CR>
20
+
21
+ let &cpo = s: save_cpo
22
+ unlet s: save_cpo
Original file line number Diff line number Diff line change @@ -321,3 +321,16 @@ Expect javascript:
321
321
console.log('foo')
322
322
}
323
323
}
324
+
325
+ Given javascriptreact (named function with no arg):
326
+ function foo() { }
327
+
328
+ Execute:
329
+ JsDoc
330
+ :sleep 1
331
+
332
+ Expect javascript:
333
+ /**
334
+ * foo.
335
+ */
336
+ function foo() { }
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ Execute:
12
12
:JsDoc
13
13
:sleep 1
14
14
15
- Expect javascript :
15
+ Expect typescript :
16
16
/**
17
17
* foo.
18
18
*
@@ -33,7 +33,7 @@ Execute:
33
33
:JsDoc
34
34
:sleep 1
35
35
36
- Expect javascript :
36
+ Expect typescript :
37
37
/**
38
38
* foo.
39
39
*
@@ -52,7 +52,7 @@ Execute:
52
52
:JsDoc
53
53
:sleep 1
54
54
55
- Expect javascript :
55
+ Expect typescript :
56
56
/**
57
57
* IFoo.
58
58
*/
@@ -68,7 +68,7 @@ Execute:
68
68
:JsDoc
69
69
:sleep 1
70
70
71
- Expect javascript :
71
+ Expect typescript :
72
72
/**
73
73
* Bar.
74
74
*
@@ -90,7 +90,7 @@ Execute:
90
90
:JsDoc
91
91
:sleep 1
92
92
93
- Expect javascript :
93
+ Expect typescript :
94
94
class Bar extends Foo implements IFoo {
95
95
/**
96
96
* constructor.
@@ -114,7 +114,7 @@ Execute:
114
114
:JsDoc
115
115
:sleep 1
116
116
117
- Expect javascript :
117
+ Expect typescript :
118
118
class Bar extends Foo implements IFoo {
119
119
/**
120
120
* foo.
@@ -126,3 +126,24 @@ Expect javascript:
126
126
private foo(arg1: string, arg2: number = 0): void {
127
127
}
128
128
}
129
+
130
+ Given typescript (typescriptreact):
131
+ function foo(foo: string = 'foo', bar: number = 1): string {
132
+ return 'foo'
133
+ }
134
+
135
+ Execute:
136
+ :JsDoc
137
+ :sleep 1
138
+
139
+ Expect typescript:
140
+ /**
141
+ * foo.
142
+ *
143
+ * @param {string} foo
144
+ * @param {number} bar
145
+ * @returns {string}
146
+ */
147
+ function foo(foo: string = 'foo', bar: number = 1): string {
148
+ return 'foo'
149
+ }
You can’t perform that action at this time.
0 commit comments