File tree Expand file tree Collapse file tree 3 files changed +33
-6
lines changed Expand file tree Collapse file tree 3 files changed +33
-6
lines changed Original file line number Diff line number Diff line change 15
15
fail-fast : false
16
16
matrix :
17
17
os : [ubuntu-latest, macos-latest]
18
- vim-version : [v7.4.2119, v8.2.5172, head ]
18
+ vim-version : [v7.4.2119, v8.2.5172, v9.0.1500 ]
19
19
runs-on : ${{ matrix.os }}
20
20
steps :
21
21
- name : Checkout kkoomen/vim-doge
Original file line number Diff line number Diff line change @@ -100,15 +100,19 @@ impl<'a> RustParser<'a> {
100
100
. for_each ( |node| {
101
101
let mut param = Map :: new ( ) ;
102
102
103
- let func_name = node
103
+ let name = node
104
104
. children ( & mut node. walk ( ) )
105
105
. filter ( |node| node. kind ( ) == "identifier" )
106
106
. next ( )
107
- . and_then ( |node| Some ( self . get_node_text ( & node) ) )
108
- . unwrap ( ) ;
109
- param. insert ( "name" . to_string ( ) , Value :: String ( func_name) ) ;
107
+ . and_then ( |node| Some ( self . get_node_text ( & node) ) ) ;
110
108
111
- params. push ( Value :: Object ( param) ) ;
109
+ if name. is_some ( ) {
110
+ param. insert ( "name" . to_string ( ) , Value :: String ( name. unwrap ( ) ) ) ;
111
+ }
112
+
113
+ if !param. is_empty ( ) {
114
+ params. push ( Value :: Object ( param) ) ;
115
+ }
112
116
} ) ;
113
117
114
118
if !params. is_empty ( ) {
Original file line number Diff line number Diff line change @@ -59,6 +59,29 @@ Expect rust (generated comments with Arguments and Examples sections):
59
59
}
60
60
}
61
61
62
+ # ==============================================================================
63
+ # Functions parameter destruction
64
+ # ==============================================================================
65
+ Given rust (function with destructured params):
66
+ pub fn do_thing((i, j): (u8, u8)) -> u8 {
67
+ i * j
68
+ }
69
+
70
+ Do (trigger doge):
71
+ \<C-d>
72
+
73
+ Expect rust (generated comments):
74
+ /// [TODO:description]
75
+ ///
76
+ /// # Examples
77
+ ///
78
+ /// ```
79
+ /// [TODO:write some example code]
80
+ /// ```
81
+ pub fn do_thing((i, j): (u8, u8)) -> u8 {
82
+ i * j
83
+ }
84
+
62
85
# ==============================================================================
63
86
# Functions with errors and safety section
64
87
# ==============================================================================
You can’t perform that action at this time.
0 commit comments