@@ -30,7 +30,7 @@ link completions are smart about closing `:` and `}`.
3030local neorg = require (" neorg.core" )
3131local Path = require (" pathlib" )
3232local log , modules , utils = neorg .log , neorg .modules , neorg .utils
33- local dirutils , dirman , link_utils , treesitter
33+ local dirutils , dirman , link_utils , ts
3434
3535local module = modules .create (" core.completion" )
3636
@@ -101,7 +101,7 @@ module.private = {
101101 --- @param link_type " generic" | " definition" | " footnote" | string
102102 get_linkables = function (source , link_type )
103103 local query_str = link_utils .get_link_target_query_string (link_type )
104- local norg_parser , iter_src = treesitter .get_ts_parser (source )
104+ local norg_parser , iter_src = ts .get_ts_parser (source )
105105 if not norg_parser then
106106 return {}
107107 end
@@ -111,7 +111,7 @@ module.private = {
111111 for id , node in query :iter_captures (norg_tree :root (), iter_src , 0 , - 1 ) do
112112 local capture = query .captures [id ]
113113 if capture == " title" then
114- local original_title = treesitter .get_node_text (node , iter_src )
114+ local original_title = ts .get_node_text (node , iter_src )
115115 if original_title then
116116 local title = original_title :gsub (" \\ " , " " )
117117 title = title :gsub (" %s+" , " " )
@@ -230,7 +230,7 @@ module.private = {
230230module .private .foreign_link_names = function (_context , _prev , _saved , match )
231231 local file , target = match [2 ], match [3 ]
232232 local path = dirutils .expand_pathlib (file )
233- local meta = treesitter .get_document_metadata (path )
233+ local meta = ts .get_document_metadata (path )
234234 local suggestions = {}
235235 if meta then
236236 table.insert (suggestions , meta .title )
@@ -253,10 +253,10 @@ module.private.anchor_suggestions = function(_context, _prev, _saved, _match)
253253 text: (paragraph) @anchor_name ))
254254 ]]
255255
256- treesitter .execute_query (anchor_query_string , function (query , id , node , _metadata )
256+ ts .execute_query (anchor_query_string , function (query , id , node , _metadata )
257257 local capture_name = query .captures [id ]
258258 if capture_name == " anchor_name" then
259- table.insert (suggestions , treesitter .get_node_text (node , 0 ))
259+ table.insert (suggestions , ts .get_node_text (node , 0 ))
260260 end
261261 end , 0 )
262262 return suggestions
@@ -304,7 +304,7 @@ module.load = function()
304304 dirman = module .required [" core.dirman" ]
305305 link_utils = module .required [" core.links" ]
306306 --- @type core.integrations.treesitter
307- treesitter = module .required [" core.integrations.treesitter" ]
307+ ts = module .required [" core.integrations.treesitter" ]
308308
309309 -- Set a special function in the integration module to allow it to communicate with us
310310 module .private .engine .invoke_completion_engine = function (context ) --- @diagnostic disable-line
@@ -693,7 +693,7 @@ module.public = {
693693 return { items = {}, options = {} }
694694 end
695695
696- local previous_node = treesitter .get_previous_node (current_node , true , true )
696+ local previous_node = ts .get_previous_node (current_node , true , true )
697697
698698 -- If the previous node is nil
699699 if not previous_node then
@@ -726,7 +726,7 @@ module.public = {
726726 return { items = {}, options = {} }
727727 end
728728
729- local next_node = treesitter .get_next_node (current_node , true , true )
729+ local next_node = ts .get_next_node (current_node , true , true )
730730
731731 -- If it's nil
732732 if not next_node then
@@ -770,12 +770,12 @@ module.public = {
770770 return ret_completions
771771 end
772772
773- local next_node = treesitter .get_next_node (current_node , true , true )
774- local previous_node = treesitter .get_previous_node (current_node , true , true )
773+ local next_node = ts .get_next_node (current_node , true , true )
774+ local previous_node = ts .get_previous_node (current_node , true , true )
775775
776776 -- Execute the callback function with all of our parameters.
777777 -- If it returns true then that means the match was successful, and so return completions
778- if completion_data .node (current_node , previous_node , next_node , treesitter ) then
778+ if completion_data .node (current_node , previous_node , next_node , ts ) then
779779 return ret_completions
780780 end
781781
0 commit comments