11local M = {}
22
33local vc_config = require (" vectorcode.config" )
4+
5+ local logger = vc_config .logger
6+
47local get_config = vc_config .get_user_config
58
69local notify_opts = vc_config .notify_opts
@@ -15,6 +18,7 @@ M.query = vc_config.check_cli_wrap(
1518 --- @param callback fun ( result : VectorCode.Result[] )? Use the result async style.
1619 --- @return VectorCode.Result[] ? An array of results.
1720 function (query_message , opts , callback )
21+ logger .info (" vectorcode.query: " , query_message , opts , callback )
1822 opts = vim .tbl_deep_extend (" force" , vc_config .get_query_opts (), opts or {})
1923 if opts .n_query == 0 then
2024 if opts .notify then
@@ -45,8 +49,10 @@ M.query = vc_config.check_cli_wrap(
4549 vim .list_extend (args , { " --exclude" , vim .api .nvim_buf_get_name (0 ) })
4650 end
4751
52+ logger .debug (" vectorcode.query cmd args: " , args )
4853 local decoded_response = {}
4954 local job = vim .system (args , { text = true }, function (out )
55+ logger .debug (" vectorcode.query cmd output: " , out )
5056 local raw_response
5157 if out .code == 124 and out .signal == 9 then
5258 -- killed due to timeout
@@ -77,6 +83,7 @@ M.query = vc_config.check_cli_wrap(
7783 if type (callback ) == " function" then
7884 callback (decoded_response )
7985 end
86+ logger .info (" vectorcode.query result:\n " , decoded_response )
8087 end
8188 end )
8289
@@ -95,6 +102,7 @@ M.vectorise = vc_config.check_cli_wrap(
95102 --- @param files string | string[] Files to vectorise.
96103 --- @param project_root string ? Add the ` --project_root` flag and the passed argument to the command.
97104 function (files , project_root )
105+ logger .info (" vectorcode.vectorise: " , files , project_root )
98106 local args = { " --pipe" , " vectorise" }
99107 if project_root ~= nil then
100108 vim .list_extend (args , { " --project_root" , project_root })
@@ -130,6 +138,7 @@ M.vectorise = vc_config.check_cli_wrap(
130138 )
131139 end )
132140 end
141+ logger .debug (" vectorcode.vectorise cmd args: " , args )
133142 require (" plenary.job" )
134143 :new ({
135144 command = " vectorcode" ,
@@ -158,14 +167,17 @@ M.vectorise = vc_config.check_cli_wrap(
158167
159168--- @param project_root string ?
160169M .update = vc_config .check_cli_wrap (function (project_root )
170+ logger .info (" vectorcode.update: " , project_root )
161171 local args = { " vectorcode" , " update" }
162172 if
163173 type (project_root ) == " string"
164174 and vim .uv .fs_stat (vim .fs .normalize (project_root )).type == " directory"
165175 then
166176 vim .list_extend (args , { " --project_root" , project_root })
167177 end
178+ logger .debug (" vectorcode.update cmd args: " , args )
168179 vim .system (args , { stdout = nil , stderr = nil }, function (out )
180+ logger .debug (" vectorcode.update cmd out:\n " , out )
169181 if get_config ().notify then
170182 vim .schedule (function ()
171183 if out .code == 0 then
0 commit comments