Skip to content

Commit

Permalink
feat(c,cpp): add in-out direction docblock param jumps (closes #533)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoomen committed May 1, 2023
1 parent f772669 commit 4872f45
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 101 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
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) {}
6 changes: 3 additions & 3 deletions test/filetypes/cpp/functions-doc-qt.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) {}
12 changes: 6 additions & 6 deletions test/filetypes/cpp/functions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,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 @@ -58,7 +58,7 @@ 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) {}

Expand All @@ -77,9 +77,9 @@ Expect cpp (generated comment with @brief and @param tag):
/**
* @brief [TODO:summary]
*
* @param a [TODO:description]
* @param b [TODO:description]
* @param c [TODO:description]
* @param[[TODO:direction]] a [TODO:description]
* @param[[TODO:direction]] b [TODO:description]
* @param[[TODO:direction]] c [TODO:description]
* @return [TODO:description]
*/
int* fun1(int a,int b,int c){
Expand Down
4 changes: 2 additions & 2 deletions test/filetypes/cpp/inline-functions.vader
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Expect cpp (generated comment with @brief, @param and @return tags):
/**
* @brief [TODO:summary]
*
* @param lhs [TODO:description]
* @param rhs [TODO:description]
* @param[[TODO:direction]] lhs [TODO:description]
* @param[[TODO:direction]] rhs [TODO:description]
* @return [TODO:description]
*/
inline bool operator<(const value_t lhs, const value_t rhs) noexcept {}
Loading

0 comments on commit 4872f45

Please sign in to comment.