File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
lua/luasnip-snippets/snippets/cpp Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -220,6 +220,7 @@ tmss! -> absl::flat_hash_map<std::string, std::string>
220
220
| ` .uu ` | Wraps with ` (void)? ` . | ` any_expr ` |
221
221
| ` .ts ` | Switches indent's coding style between ` CamelCase ` and ` snake_case ` . | ` indent ` |
222
222
| ` .sc ` | Wraps with ` static_cast<>(?) ` . | ` any_expr ` |
223
+ | ` .rc ` | Wraps with ` reinterpret_cast<>(?) ` . | ` any_expr ` |
223
224
| ` .single ` | Wraps with ` ranges::views::single(?) ` . | ` any_expr ` |
224
225
| ` .await ` | Expands to ` co_await ? ` . | ` any_expr ` |
225
226
| ` .in ` | Expands to ` if (...find) ` statements. | ` any_expr ` |
Original file line number Diff line number Diff line change @@ -131,6 +131,32 @@ return {
131
131
)
132
132
),
133
133
134
+ tsp .treesitter_postfix (
135
+ {
136
+ trig = " .rc" ,
137
+ name = " (.rc) reinterpret_cast<TYPE>(?)" ,
138
+ dscr = " Wraps an expression with reinterpret_cast<TYPE>(?)" ,
139
+ wordTrig = false ,
140
+ reparseBuffer = " live" ,
141
+ matchTSNode = {
142
+ query = expr_query ,
143
+ query_lang = " cpp" ,
144
+ },
145
+ },
146
+ fmt (
147
+ [[
148
+ reinterpret_cast<{body}>({expr}){end}
149
+ ]] ,
150
+ {
151
+ body = i (1 ),
152
+ expr = f (function (_ , parent )
153
+ return Utils .replace_all (parent .snippet .env .LS_TSMATCH , " %s" )
154
+ end , {}),
155
+ [" end" ] = i (0 ),
156
+ }
157
+ )
158
+ ),
159
+
134
160
tsp .treesitter_postfix (
135
161
{
136
162
trig = " .in" ,
You can’t perform that action at this time.
0 commit comments