@@ -20,7 +20,6 @@ local fmta = require("luasnip.extras.fmt").fmta
2020local types = require (" luasnip.util.types" )
2121local conds = require (" luasnip.extras.conditions" )
2222local conds_expand = require (" luasnip.extras.conditions.expand" )
23- local ts_utils = require (" nvim-treesitter.ts_utils" )
2423
2524vim .treesitter .query .set (
2625 " c_sharp" ,
@@ -34,69 +33,6 @@ vim.treesitter.query.set(
3433 ]]
3534)
3635
37- --- @param node TSNode ?
38- local function get_parent_method_or_bust (node )
39- if not node then
40- return
41- end
42- if node :type () == " method_declaration" then
43- return node
44- end
45- return get_parent_method_or_bust (node :parent ())
46- end
47-
48- --- @param method_declaration TSNode
49- local function get_inline_data_attribute_argument_list_or_bust (method_declaration )
50- local query = vim .treesitter .query .get (" c_sharp" , " InlineDataArgs_Result" )
51- if not query then
52- return
53- end
54- local args
55- for _ , node in query :iter_captures (method_declaration , 0 ) do
56- args = node
57- end
58- return args
59- end
60-
61- --- @param arg_list TSNode
62- local function get_args_as_nodes_or_bust (arg_list )
63- local result = {}
64- local count = arg_list :named_child_count ()
65- for index = 0 , count - 1 do
66- local node = arg_list :named_child (index )
67- local param = vim .treesitter .get_node_text (node , 0 )
68- table.insert (result , i (index + 1 , param ))
69- if index ~= count - 1 then
70- table.insert (result , t ({ " , " }))
71- end
72- end
73- if # result == 0 then
74- return
75- end
76- return result
77- end
78-
79- local function create_snippet_nodes ()
80- local cursor_node = ts_utils .get_node_at_cursor ()
81- if not cursor_node then
82- return
83- end
84- local parent = get_parent_method_or_bust (cursor_node )
85- if not parent then
86- return
87- end
88- local args = get_inline_data_attribute_argument_list_or_bust (parent )
89- if not args then
90- return
91- end
92- local params = get_args_as_nodes_or_bust (args )
93- return params
94- end
95-
96- local function inline_data_params_snippet ()
97- return snippet_from_nodes (nil , create_snippet_nodes () or { i (1 , " " ) })
98- end
99-
10036return {
10137 snippet (
10238 " fact" ,
@@ -131,7 +67,7 @@ return {
13167 [[
13268 [InlineData({})]
13369 ]] ,
134- { d ( 1 , inline_data_params_snippet , {} ) }
70+ { i ( 0 ) }
13571 )
13672 ),
13773}
0 commit comments