Skip to content

Commit 2eb6311

Browse files
committed
Add user defined tags.
see #59
1 parent c234d42 commit 2eb6311

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

autoload/jsdoc.vim

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" File: jsdoc.vim
22
" Author: NAKAMURA, Hisashi <https://github.com/sunvisor>
33
" Modifyed: Shinya Ohyanagi <[email protected]>
4-
" Version: 0.10.1
4+
" Version: 0.11.0
55
" WebPage: http://github.com/heavenshell/vim-jsdoc/
66
" Description: Generate JSDoc to your JavaScript file.
77
" License: BSD, see LICENSE for more details.
@@ -29,6 +29,10 @@ let g:jsdoc_type_hook = exists('g:jsdoc_type_hook')
2929
\ ? g:jsdoc_type_hook
3030
\ : {}
3131

32+
let g:jsdoc_user_defined_tags = exists('g:jsdoc_user_defined_tags')
33+
\ ? g:jsdoc_user_defined_tags
34+
\ : {}
35+
3236
" Default tag names
3337
" @returns (synonyms: @return)
3438
" @function (synonyms: @func, @method)
@@ -402,6 +406,11 @@ function! jsdoc#insert() abort
402406
call add(l:lines, l:space . ' * @static')
403407
endif
404408

409+
" Add user defined tags.
410+
for t in keys(g:jsdoc_user_defined_tags)
411+
call add(l:lines, l:space . ' * ' . t . ' ' . g:jsdoc_user_defined_tags[t])
412+
endfor
413+
405414
let l:hook = keys(g:jsdoc_custom_args_hook)
406415
for l:arg in l:args
407416
let s:candidate_type = ''

doc/jsdoc.txt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*jsdoc.txt* Generate JSDoc to your JavaScript code.
22

3-
Version: 0.10.1
3+
Version: 0.11.0
44
Author: NAKAMURA, Hisashi <https://github.com/sunvisor>
55
Modifyed: Shinya Ohynagi <[email protected]>
66
Repository: http://github.com/heavenshell/vim-jsdoc/
@@ -277,8 +277,33 @@ g:jsdoc_tags *g:jsdoc_tags*
277277
>
278278
Can be changed on a per tag basis, for example: let g:jsdoc_tags = {} | let g:jsdoc_tags['param'] = 'arg'
279279
280+
g:jsdoc_user_defined_tags *g:jsdoc_user_defined_tags*
281+
Allow use of insert custom tags.
282+
Default value is '{}'
283+
284+
If you set following setting to .vimrc or _vimrc.
285+
>
286+
let g:jsdoc_user_defined_tags = {
287+
\ '@author': 'Foo',
288+
\ '@date': strftime('%Y-%m-%d'),
289+
\}
290+
>
291+
/**
292+
* foo
293+
*
294+
* @author Foo
295+
* @date 2016-09-11
296+
* @param {} arg1
297+
* @param {} arg2
298+
*/
299+
function foo(arg1, arg2) {
300+
}
301+
>
280302
==============================================================================
281303
CHANGELOG *jsdoc-changelog*
304+
2016-09-11
305+
- Add g:jsdoc_user_defined_tags option for insert custom tags.
306+
282307
2016-09-11
283308
- Fix private, public bug.
284309

ftplugin/javascript/jsdoc.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" File: jsdoc.vim
22
" Author: NAKAMURA, Hisashi <https://github.com/sunvisor>
33
" Modifyed: Shinya Ohyanagi <[email protected]>
4-
" Version: 0.10.1
4+
" Version: 0.11.0
55
" WebPage: http://github.com/heavenshell/vim-jsdoc/
66
" Description: Generate JSDoc to your JavaScript file.
77
" License: BSD, see LICENSE for more details.

ftplugin/typescript/jsdoc.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" File: jsdoc.vim
22
" Author: NAKAMURA, Hisashi <https://github.com/sunvisor>
33
" Modifyed: Shinya Ohyanagi <[email protected]>
4-
" Version: 0.10.1
4+
" Version: 0.11.0
55
" WebPage: http://github.com/heavenshell/vim-jsdoc/
66
" Description: Generate JSDoc to your JavaScript file.
77
" License: BSD, see LICENSE for more details.

0 commit comments

Comments
 (0)