Skip to content

Commit

Permalink
fix(#37): Allow generation for Java body-less method declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed Aug 26, 2019
1 parent bd49e4a commit f0169c0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ftplugin/java.vim
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ let b:doge_patterns = []
"
" void MyParameterizedFunction(String p1, int p2, Boolean ...params) {}
call add(b:doge_patterns, {
\ 'match': '\m^\%(\%(public\|private\|protected\|static\|final\)\s*\)*\%(\%(\([[:alnum:]_]\+\)\?\s*\%(<[[:alnum:][:space:]_,]*>\)\?\)\?\s\+\)\?\%([[:alnum:]_]\+\)(\(.\{-}\))\s*{',
\ 'match': '\m^\%(\%(public\|private\|protected\|static\|final\)\s*\)*\%(\%(\([[:alnum:]_]\+\)\?\s*\%(<[[:alnum:][:space:]_,]*>\)\?\)\?\s\+\)\?\%([[:alnum:]_]\+\)(\(.\{-}\))\s*[;{]',
\ 'match_group_names': ['returnType', 'parameters'],
\ 'parameters': {
\ 'match': '\m\%(\([[:alnum:]_]\+\)\%(<[[:alnum:][:space:]_,]\+>\)\?\)\%(\s\+[.]\{3}\s\+\|\s\+[.]\{3}\|[.]\{3}\s\+\|\s\+\)\([[:alnum:]_]\+\)',
Expand Down
6 changes: 6 additions & 0 deletions playground/test.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ private void setChildrenRecursively(ElementDto childDto, int childId) {
//
}

/**
* [TODO:description]
* @return void [TODO:description]
*/
void foo();

/**
* [TODO:description]
* @param int childId [TODO:description]
Expand Down
10 changes: 10 additions & 0 deletions test/filetypes/java/class-methods.vader
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
Given java (method without parameters):
class Test {
List<Element> createSortedList() {}

void foo();
}

Do (trigger doge):
:2\<CR>
\<C-d>
:8\<CR>
\<C-d>

Expect java (method with 'TODO' and a @return tag):
class Test {
Expand All @@ -17,6 +21,12 @@ Expect java (method with 'TODO' and a @return tag):
* @return List [TODO:description]
*/
List<Element> createSortedList() {}

/**
* [TODO:description]
* @return void [TODO:description]
*/
void foo();
}

# ==============================================================================
Expand Down

0 comments on commit f0169c0

Please sign in to comment.