Skip to content

Commit

Permalink
Merge pull request #557 from kkoomen/feature/doxygen-in-out-direction…
Browse files Browse the repository at this point in the history
…-param-tags

feat(c,cpp): add in-out direction docblock param jumps (closes #533)
  • Loading branch information
kkoomen authored May 1, 2023
2 parents 2f48955 + af45366 commit 8a267a1
Show file tree
Hide file tree
Showing 27 changed files with 116 additions and 108 deletions.
2 changes: 1 addition & 1 deletion ftplugin/c.vim
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let b:doge_patterns = doge#buffer#get_patterns()
let s:function_pattern = {
\ 'nodeTypes': ['function_definition', 'declaration'],
\ 'parameters': {
\ 'format': b:char . 'param {name} !description',
\ 'format': b:char . 'param[!direction] {name} !description',
\ },
\}

Expand Down
2 changes: 1 addition & 1 deletion ftplugin/cpp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let b:doge_patterns = doge#buffer#get_patterns()
" ==============================================================================
let s:pattern_base = {
\ 'parameters': {
\ 'format': b:char . 'param {name} !description',
\ 'format': b:char . 'param[!direction] {name} !description',
\ },
\ 'typeParameters': {
\ 'format': b:char . 'tparam {name} !description',
Expand Down
12 changes: 10 additions & 2 deletions scripts/run-vader-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ run_file="$(mktemp)"

function filter-vader-output() {
local hit_first_vader_line=0
local force_echo=0

while read -r; do
echo "$REPLY"
# Search for the first Vader output line.
if ((!hit_first_vader_line)); then
if [[ "$REPLY" = *'Starting Vader:'* ]]; then
Expand All @@ -31,10 +31,18 @@ function filter-vader-output() {
fi
fi

# If an error occured, make sure to print it.
if [[ "$REPLY" = *'Expected:'* ]]; then
force_echo=1
elif [[ "$REPLY" =~ \[[A-Z\ ]+\] ]]; then
force_echo=0
fi

if [[ "$REPLY" =~ \[[A-Z\ ]+\] ]] \
|| [[ "$REPLY" = *'Starting Vader:'* ]] \
|| [[ "$REPLY" = *'Success/Total'* ]] \
|| [[ "$REPLY" = *'Elapsed time:'* ]]
|| [[ "$REPLY" = *'Elapsed time:'* ]] \
|| [[ $force_echo = 1 ]]
then
echo "$REPLY"
fi
Expand Down
8 changes: 4 additions & 4 deletions test/commands/generate.vader
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ Expect c (generated comments):
/**
* @brief [TODO:summary]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @param[[TODO:direction]] x [TODO:description]
* @param[[TODO:direction]] y [TODO:description]
* @return [TODO:description]
*/
int testA(int x, int y) {}

/**
* @brief [TODO:summary]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @param[[TODO:direction]] x [TODO:description]
* @param[[TODO:direction]] y [TODO:description]
* @return [TODO:description]
*/
int testB(int x, int y) {}
Expand Down
4 changes: 2 additions & 2 deletions test/filetypes/c/function-declarations.vader
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Expect c (generated comment with @brief, @param and @return tags):
/**
* @brief [TODO:summary]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @param[[TODO:direction]] x [TODO:description]
* @param[[TODO:direction]] y [TODO:description]
* @return [TODO:description]
*/
int add(int x, int y);
8 changes: 4 additions & 4 deletions test/filetypes/c/functions-doc-cpp-exclamation.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Expect c (generated comment with @brief, @param and @return tags):
//!
//! @brief [TODO:summary]
//!
//! @param x [TODO:description]
//! @param y [TODO:description]
//! @param[[TODO:direction]] x [TODO:description]
//! @param[[TODO:direction]] y [TODO:description]
//! @return [TODO:description]
//!
int add(int x, int y) {}
Expand All @@ -32,7 +32,7 @@ Expect c (generated comment with @brief and @param tags):
//!
//! @brief [TODO:summary]
//!
//! @param x [TODO:description]
//! @param y [TODO:description]
//! @param[[TODO:direction]] x [TODO:description]
//! @param[[TODO:direction]] y [TODO:description]
//!
void add(int x, int y) {}
8 changes: 4 additions & 4 deletions test/filetypes/c/functions-doc-cpp-slash-banner.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Expect c (generated comment with @brief, @param and @return tags):
////////////////////////////////////////////////////////////////////////////////
/// @brief [TODO:summary]
///
/// @param x [TODO:description]
/// @param y [TODO:description]
/// @param[[TODO:direction]] x [TODO:description]
/// @param[[TODO:direction]] y [TODO:description]
/// @return [TODO:description]
////////////////////////////////////////////////////////////////////////////////
int add(int x, int y) {}
Expand All @@ -32,7 +32,7 @@ Expect c (generated comment with @brief and @param tags):
////////////////////////////////////////////////////////////////////////////////
/// @brief [TODO:summary]
///
/// @param x [TODO:description]
/// @param y [TODO:description]
/// @param[[TODO:direction]] x [TODO:description]
/// @param[[TODO:direction]] y [TODO:description]
////////////////////////////////////////////////////////////////////////////////
void add(int x, int y) {}
8 changes: 4 additions & 4 deletions test/filetypes/c/functions-doc-cpp-slash.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Expect c (generated comment with @brief, @param and @return tags):
///
/// @brief [TODO:summary]
///
/// @param x [TODO:description]
/// @param y [TODO:description]
/// @param[[TODO:direction]] x [TODO:description]
/// @param[[TODO:direction]] y [TODO:description]
/// @return [TODO:description]
///
int add(int x, int y) {}
Expand All @@ -32,7 +32,7 @@ Expect c (generated comment with @brief and @param tags):
///
/// @brief [TODO:summary]
///
/// @param x [TODO:description]
/// @param y [TODO:description]
/// @param[[TODO:direction]] x [TODO:description]
/// @param[[TODO:direction]] y [TODO:description]
///
void add(int x, int y) {}
8 changes: 4 additions & 4 deletions test/filetypes/c/functions-doc-javadoc-banner.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Expect c (generated comment with @brief, @param and @return tags):
/*******************************************************************************
* @brief [TODO:summary]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @param[[TODO:direction]] x [TODO:description]
* @param[[TODO:direction]] y [TODO:description]
* @return [TODO:description]
******************************************************************************/
int add(int x, int y) {}
Expand All @@ -32,7 +32,7 @@ Expect c (generated comment with @brief and @param tags):
/*******************************************************************************
* @brief [TODO:summary]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @param[[TODO:direction]] x [TODO:description]
* @param[[TODO:direction]] y [TODO:description]
******************************************************************************/
void add(int x, int y) {}
8 changes: 4 additions & 4 deletions test/filetypes/c/functions-doc-javadoc-no-asterisk.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Expect c (generated comment with @brief, @param and @return tags):
/**
@brief [TODO:summary]

@param x [TODO:description]
@param y [TODO:description]
@param[[TODO:direction]] x [TODO:description]
@param[[TODO:direction]] y [TODO:description]
@return [TODO:description]
*/
int add(int x, int y) {}
Expand All @@ -32,7 +32,7 @@ Expect c (generated comment with @brief and @param tags):
/**
@brief [TODO:summary]

@param x [TODO:description]
@param y [TODO:description]
@param[[TODO:direction]] x [TODO:description]
@param[[TODO:direction]] y [TODO:description]
*/
void add(int x, int y) {}
8 changes: 4 additions & 4 deletions test/filetypes/c/functions-doc-qt-no-asterisk.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Expect c (generated comment with @brief, @param and @return tags):
/*!
@brief [TODO:summary]

@param x [TODO:description]
@param y [TODO:description]
@param[[TODO:direction]] x [TODO:description]
@param[[TODO:direction]] y [TODO:description]
@return [TODO:description]
*/
int add(int x, int y) {}
Expand All @@ -32,7 +32,7 @@ Expect c (generated comment with @brief and @param tags):
/*!
@brief [TODO:summary]

@param x [TODO:description]
@param y [TODO:description]
@param[[TODO:direction]] x [TODO:description]
@param[[TODO:direction]] y [TODO:description]
*/
void add(int x, int y) {}
8 changes: 4 additions & 4 deletions test/filetypes/c/functions-doc-qt.vader
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Expect c (generated comment with @brief, @param and @return tags):
/*!
* @brief [TODO:summary]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @param[[TODO:direction]] x [TODO:description]
* @param[[TODO:direction]] y [TODO:description]
* @return [TODO:description]
*/
int add(int x, int y) {}
Expand All @@ -32,7 +32,7 @@ Expect c (generated comment with @brief and @param tags):
/*!
* @brief [TODO:summary]
*
* @param x [TODO:description]
* @param y [TODO:description]
* @param[[TODO:direction]] x [TODO:description]
* @param[[TODO:direction]] y [TODO:description]
*/
void add(int x, int y) {}
8 changes: 4 additions & 4 deletions test/filetypes/c/functions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ Expect c (generated comment with @brief, @param and @return tags):
/**
* @brief [TODO:summary]
*
* @param a [TODO:description]
* @param b [TODO:description]
* @param[[TODO:direction]] a [TODO:description]
* @param[[TODO:direction]] b [TODO:description]
* @return [TODO:description]
*/
int foo(int a, char b) {}

/**
* @brief [TODO:summary]
*
* @param a [TODO:description]
* @param b [TODO:description]
* @param[[TODO:direction]] a [TODO:description]
* @param[[TODO:direction]] b [TODO:description]
* @return [TODO:description]
*/
int *foo(int a, char b) {}
6 changes: 3 additions & 3 deletions test/filetypes/cpp/auto-functions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Expect cpp (generated comment with @brief, @tparam, @param and @return tags):
*
* @tparam F [TODO:description]
* @tparam Args [TODO:description]
* @param builder [TODO:description]
* @param[[TODO:direction]] builder [TODO:description]
* @return [TODO:description]
*/
template<class F, class... Args>
Expand Down Expand Up @@ -45,8 +45,8 @@ Expect cpp (generated comment with @brief, @tparam, @param and @return tags):
*
* @tparam T [TODO:description]
* @tparam U [TODO:description]
* @param t [TODO:description]
* @param u [TODO:description]
* @param[[TODO:direction]] t [TODO:description]
* @param[[TODO:direction]] u [TODO:description]
* @return [TODO:description]
*/
template<class T, class U>
Expand Down
4 changes: 2 additions & 2 deletions test/filetypes/cpp/function-declarations.vader
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Expect cpp (generated comment with @param and @return tags):
/**
* @brief [TODO:summary]
*
* @param text [TODO:description]
* @param node [TODO:description]
* @param[[TODO:direction]] text [TODO:description]
* @param[[TODO:direction]] node [TODO:description]
*/
void append_token(const std::string& text /* inline comment */, const AST_Node* node);
6 changes: 3 additions & 3 deletions test/filetypes/cpp/functions-doc-cpp-exclamation.vader
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Expect cpp (generated comment with @brief, @param and @return tags):
//!
//! @brief [TODO:summary]
//!
//! @param text [TODO:description]
//! @param node [TODO:description]
//! @param[[TODO:direction]] text [TODO:description]
//! @param[[TODO:direction]] node [TODO:description]
//! @return [TODO:description]
//!
int TestClass::myFunc(const std::string& text /* inline comment */, const Node* node) {}
Expand All @@ -61,6 +61,6 @@ Expect cpp (generated comment with @brief and @param tag):
//!
//! @brief [TODO:summary]
//!
//! @param p [TODO:description]
//! @param[[TODO:direction]] p [TODO:description]
//!
void f(A* p = this) {}
6 changes: 3 additions & 3 deletions test/filetypes/cpp/functions-doc-cpp-slash-banner.vader
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Expect cpp (generated comment with @brief, @param and @return tags):
////////////////////////////////////////////////////////////////////////////////
/// @brief [TODO:summary]
///
/// @param text [TODO:description]
/// @param node [TODO:description]
/// @param[[TODO:direction]] text [TODO:description]
/// @param[[TODO:direction]] node [TODO:description]
/// @return [TODO:description]
////////////////////////////////////////////////////////////////////////////////
int TestClass::myFunc(const std::string& text /* inline comment */, const Node* node) {}
Expand All @@ -61,6 +61,6 @@ Expect cpp (generated comment with @brief and @param tag):
////////////////////////////////////////////////////////////////////////////////
/// @brief [TODO:summary]
///
/// @param p [TODO:description]
/// @param[[TODO:direction]] p [TODO:description]
////////////////////////////////////////////////////////////////////////////////
void f(A* p = this) {}
6 changes: 3 additions & 3 deletions test/filetypes/cpp/functions-doc-cpp-slash.vader
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Expect cpp (generated comment with @brief, @param and @return tags):
///
/// @brief [TODO:summary]
///
/// @param text [TODO:description]
/// @param node [TODO:description]
/// @param[[TODO:direction]] text [TODO:description]
/// @param[[TODO:direction]] node [TODO:description]
/// @return [TODO:description]
///
int TestClass::myFunc(const std::string& text /* inline comment */, const Node* node) {}
Expand All @@ -61,6 +61,6 @@ Expect cpp (generated comment with @brief and @param tag):
///
/// @brief [TODO:summary]
///
/// @param p [TODO:description]
/// @param[[TODO:direction]] p [TODO:description]
///
void f(A* p = this) {}
6 changes: 3 additions & 3 deletions test/filetypes/cpp/functions-doc-javadoc-banner.vader
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Expect cpp (generated comment with @brief, @param and @return tags):
/*******************************************************************************
* @brief [TODO:summary]
*
* @param text [TODO:description]
* @param node [TODO:description]
* @param[[TODO:direction]] text [TODO:description]
* @param[[TODO:direction]] node [TODO:description]
* @return [TODO:description]
******************************************************************************/
int TestClass::myFunc(const std::string& text /* inline comment */, const Node* node) {}
Expand All @@ -61,6 +61,6 @@ Expect cpp (generated comment with @brief and @param tag):
/*******************************************************************************
* @brief [TODO:summary]
*
* @param p [TODO:description]
* @param[[TODO:direction]] p [TODO:description]
******************************************************************************/
void f(A* p = this) {}
6 changes: 3 additions & 3 deletions test/filetypes/cpp/functions-doc-javadoc-no-asterisk.vader
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Expect cpp (generated comment with @brief, @param and @return tags):
/**
@brief [TODO:summary]

@param text [TODO:description]
@param node [TODO:description]
@param[[TODO:direction]] text [TODO:description]
@param[[TODO:direction]] node [TODO:description]
@return [TODO:description]
*/
int TestClass::myFunc(const std::string& text /* inline comment */, const Node* node) {}
Expand All @@ -61,6 +61,6 @@ Expect cpp (generated comment with @brief and @param tag):
/**
@brief [TODO:summary]

@param p [TODO:description]
@param[[TODO:direction]] p [TODO:description]
*/
void f(A* p = this) {}
6 changes: 3 additions & 3 deletions test/filetypes/cpp/functions-doc-qt-no-asterisk.vader
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Expect cpp (generated comment with @brief, @param and @return tags):
/*!
@brief [TODO:summary]

@param text [TODO:description]
@param node [TODO:description]
@param[[TODO:direction]] text [TODO:description]
@param[[TODO:direction]] node [TODO:description]
@return [TODO:description]
*/
int TestClass::myFunc(const std::string& text /* inline comment */, const Node* node) {}
Expand All @@ -61,6 +61,6 @@ Expect cpp (generated comment with @brief and @param tag):
/*!
@brief [TODO:summary]

@param p [TODO:description]
@param[[TODO:direction]] p [TODO:description]
*/
void f(A* p = this) {}
Loading

0 comments on commit 8a267a1

Please sign in to comment.