Skip to content

Commit

Permalink
feat: Rebase changes from 25c64d1 v1.17.4
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Dec 1, 2019
1 parent 5bc5c25 commit 23196a9
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
17 changes: 17 additions & 0 deletions autoload/doge/preprocessors/javascript.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
let s:save_cpo = &cpoptions
set cpoptions&vim

" A callback function being called after the tokens have been extracted. This
" function will adjust the input if needed.
function! doge#preprocessors#javascript#tokens(tokens) abort
if has_key(a:tokens, 'returnType')
if a:tokens['returnType'] ==# 'void'
let a:tokens['returnType'] = ''
elseif a:tokens['returnType'] ==# ''
let a:tokens['returnType'] = '!type'
endif
endif
endfunction

let &cpoptions = s:save_cpo
unlet s:save_cpo
15 changes: 15 additions & 0 deletions autoload/doge/preprocessors/typescript.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
let s:save_cpo = &cpoptions
set cpoptions&vim

function! doge#preprocessors#typescript#tokens(tokens) abort
if has_key(a:tokens, 'returnType')
if a:tokens['returnType'] ==# 'void'
let a:tokens['returnType'] = ''
elseif a:tokens['returnType'] ==# ''
let a:tokens['returnType'] = '!type'
endif
endif
endfunction

let &cpoptions = s:save_cpo
unlet s:save_cpo
8 changes: 4 additions & 4 deletions ftplugin/javascript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(async| * @{async})%',
\ ' * @function {funcName|}',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand All @@ -145,7 +145,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(static| * @static)%',
\ '%(async| * @async)%',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand All @@ -157,7 +157,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(async| * @async)%',
\ ' * @function {className}#{funcName}',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand All @@ -170,7 +170,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(async| * @async)%',
\ ' * @function {funcName|}',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand Down
8 changes: 4 additions & 4 deletions ftplugin/typescript.vim
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(async| * @{async})%',
\ ' * @function {funcName|}',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand All @@ -148,7 +148,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(static| * @static)%',
\ '%(async| * @async)%',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand All @@ -160,7 +160,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(async| * @async)%',
\ ' * @function {className}#{funcName}',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand All @@ -173,7 +173,7 @@ call doge#buffer#register_doc_standard('jsdoc', [
\ '%(async| * @async)%',
\ ' * @function {funcName|}',
\ '%(parameters| * {parameters})%',
\ ' * @return {{returnType|!type}} !description',
\ '%(returnType| * @return {{returnType|!type}} !description)%',
\ ' */',
\ ],
\ }),
Expand Down
1 change: 0 additions & 1 deletion playground/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ class Child extends Parent {
*
* @param {number} arg0 - [TODO:description]
* @param {string} arg1 - [TODO:description]
* @return {void} [TODO:description]
*/
public funcA(arg0: number, arg1?: string): void {

Expand Down
1 change: 0 additions & 1 deletion test/filetypes/javascript/functions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ Expect javascript (generated comment with a description, @param and @return tags
* [TODO:description]
*
* @param {string} something - [TODO:description]
* @return {void} [TODO:description]
*/
public printSomething(something?: string): void {}

Expand Down

0 comments on commit 23196a9

Please sign in to comment.