diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim index 88fd6066..ad12719c 100644 --- a/ftplugin/javascript.vim +++ b/ftplugin/javascript.vim @@ -112,7 +112,7 @@ call add(b:doge_patterns, { " " function pluck(o: T, names: K[]): T[K][] {} call add(b:doge_patterns, { -\ 'match': '\m^\%(\%(export\|public\)\s\+\)*\(static\s\+\)\?\(async\s\+\)\?\%(function\*\?\s*\)\?\%([[:alnum:]_$]\+\)\?\s*\%(<[[:alnum:][:space:]_,]*>\)\?\s*(\([^>]\{-}\))\%(\s*:\s*(\?\([[:alnum:][:space:]_[\].,|<>]\+\))\?\)\?\s*[{(]', +\ 'match': '\m^\%(\%(export\|public\|private\|protected\)\s\+\)*\(static\s\+\)\?\(async\s\+\)\?\%(function\*\?\s*\)\?\%([[:alnum:]_$]\+\)\?\s*\%(<[[:alnum:][:space:]_,]*>\)\?\s*(\([^>]\{-}\))\%(\s*:\s*(\?\([[:alnum:][:space:]_[\].,|<>]\+\))\?\)\?\s*[{(]', \ 'match_group_names': ['static', 'async', 'parameters', 'returnType'], \ 'parameters': { \ 'match': s:parameters_match_pattern, diff --git a/ftplugin/typescript.vim b/ftplugin/typescript.vim index abeb6143..ecc52aa7 100644 --- a/ftplugin/typescript.vim +++ b/ftplugin/typescript.vim @@ -115,7 +115,7 @@ call add(b:doge_patterns, { " " function pluck(o: T, names: K[]): T[K][] {} call add(b:doge_patterns, { -\ 'match': '\m^\%(\%(export\|public\)\s\+\)*\(static\s\+\)\?\(async\s\+\)\?\%(function\*\?\s*\)\?\%([[:alnum:]_$]\+\)\?\s*\%(<[[:alnum:][:space:]_,]*>\)\?\s*(\([^>]\{-}\))\%(\s*:\s*(\?\([[:alnum:][:space:]_[\].,|<>]\+\))\?\)\?\s*[{(]', +\ 'match': '\m^\%(\%(export\|public\|private\|protected\)\s\+\)*\(static\s\+\)\?\(async\s\+\)\?\%(function\*\?\s*\)\?\%([[:alnum:]_$]\+\)\?\s*\%(<[[:alnum:][:space:]_,]*>\)\?\s*(\([^>]\{-}\))\%(\s*:\s*(\?\([[:alnum:][:space:]_[\].,|<>]\+\))\?\)\?\s*[{(]', \ 'match_group_names': ['static', 'async', 'parameters', 'returnType'], \ 'parameters': { \ 'match': s:parameters_match_pattern, diff --git a/test/filetypes/javascript/functions.vader b/test/filetypes/javascript/functions.vader index 860db25d..a5dd4834 100644 --- a/test/filetypes/javascript/functions.vader +++ b/test/filetypes/javascript/functions.vader @@ -224,18 +224,26 @@ Expect javascript (generated comment with @async, @param and @return tags): async function* myFunc($p1 = 'value', p2 = [], p3, p4) {} # ============================================================================== -# Class with a public function with parameters and return type. +# Class with functions with parameters and return type. # ============================================================================== -Given javascript (class with a public function with parameters and return type): +Given javascript (class with functions with parameters and return type and differrent data modifiers): export class Test { public printSomething(something?: string): void {} + protected printSomething(something?: string): void {} + + private printSomething(something?: string): void {} + } Do (trigger doge): :3\ \ + :10\ + \ + :17\ + \ Expect javascript (generated comment with a description, @param and @return tags): export class Test { @@ -247,4 +255,18 @@ Expect javascript (generated comment with a description, @param and @return tags */ public printSomething(something?: string): void {} + /** + * [TODO:description] + * + * @param {string} something - [TODO:description] + */ + protected printSomething(something?: string): void {} + + /** + * [TODO:description] + * + * @param {string} something - [TODO:description] + */ + private printSomething(something?: string): void {} + }