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>
220220| ` .uu ` | Wraps with ` (void)? ` . | ` any_expr ` |
221221| ` .ts ` | Switches indent's coding style between ` CamelCase ` and ` snake_case ` . | ` indent ` |
222222| ` .sc ` | Wraps with ` static_cast<>(?) ` . | ` any_expr ` |
223+ | ` .rc ` | Wraps with ` reinterpret_cast<>(?) ` . | ` any_expr ` |
223224| ` .single ` | Wraps with ` ranges::views::single(?) ` . | ` any_expr ` |
224225| ` .await ` | Expands to ` co_await ? ` . | ` any_expr ` |
225226| ` .in ` | Expands to ` if (...find) ` statements. | ` any_expr ` |
Original file line number Diff line number Diff line change @@ -131,6 +131,32 @@ return {
131131 )
132132 ),
133133
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+
134160 tsp .treesitter_postfix (
135161 {
136162 trig = " .in" ,
You can’t perform that action at this time.
0 commit comments