@@ -59,8 +59,8 @@ This function queries VectorCode and returns an array of results.
5959 })
6060<
6161
62- - `query_message` string or a list of strings, the query messages;
63- - `opts` The following are the available options for this function (see | VectorCode-API-`setup(opts?)` | for details):
62+ - `query_message` : string or a list of strings, the query messages;
63+ - `opts` : The following are the available options for this function (see | VectorCode-API-`setup(opts?)` | for details):
6464
6565>lua
6666 {
@@ -71,7 +71,7 @@ This function queries VectorCode and returns an array of results.
7171 }
7272<
7373
74- - `callback` a callback function that takes the result of the retrieval as the
74+ - `callback` : a callback function that takes the result of the retrieval as the
7575 only parameter. If this is set, the `query` function will be non-blocking and
7676 runs in an async manner. In this case, it doesn’t return any value and
7777 retrieval results can only be accessed by this callback function.
@@ -118,7 +118,7 @@ project. See the CLI manual for details <./cli.md>.
118118 require("vectorcode").check()
119119<
120120
121- The following are the available options for this function: - `check_item` Only
121+ The following are the available options for this function: - `check_item` : Only
122122supports `" config" ` at the moment. Checks if a project-local config is present.
123123Return value: `true` if passed, `false` if failed.
124124
@@ -201,25 +201,25 @@ This function registers a buffer to be cached by VectorCode.
201201 })
202202<
203203
204- The following are the available options for this function: - `bufnr ` buffer
205- number. Default: `0 ` (current buffer); - `opts` accepts a lua table with the
206- following keys: - `project_root` a string of the path that overrides the
204+ The following are the available options for this function: - `bufnr ` : buffer
205+ number. Default: `0 ` (current buffer); - `opts` : accepts a lua table with the
206+ following keys: - `project_root` : a string of the path that overrides the
207207detected project root. Default: `nil` . This is mostly intended to use with the
208208| VectorCode-API-user-command | , and you probably should not use this directly in
209209your config. **If you’re using the LSP backend and did not specify this
210210value, it will be automatically detected based on .vectorcode or .git. If this
211- fails, LSP backend will not work**; - `exclude_this` whether to exclude the file
212- you’re editing. Default: `true` ; - `n_query` number of retrieved documents.
213- Default: `1 ` ; - `debounce` debounce time in milliseconds. Default: ` 10 ` ; -
214- `notify` whether to show notifications when a query is completed. Default:
215- `false` ; - `query_cb` `fun(bufnr: integer):string|string[]`, a callback function
216- that accepts the buffer ID and returns the query message(s). Default:
217- `require (" vectorcode.utils" ).make_surrounding_lines_cb (-1 )` . See
211+ fails, LSP backend will not work**; - `exclude_this` : whether to exclude the
212+ file you’re editing. Default: `true` ; - `n_query` : number of retrieved
213+ documents. Default: `1 ` ; - `debounce` : debounce time in milliseconds. Default:
214+ `10 ` ; - ` notify`: whether to show notifications when a query is completed.
215+ Default: `false` ; - `query_cb` : `fun(bufnr: integer):string|string[]`, a
216+ callback function that accepts the buffer ID and returns the query message(s).
217+ Default: `require (" vectorcode.utils" ).make_surrounding_lines_cb (-1 )` . See
218218| VectorCode-API-this-section | for a list of built-in query callbacks; -
219- `events` list of autocommand events that triggers the query. Default:
220- `{"BufWritePost", "InsertEnter", "BufReadPost"}`; - `run_on_register` whether to
221- run the query when the buffer is registered. Default: `false` ; -
222- `single_job` boolean. If this is set to `true` , there will only be one running
219+ `events` : list of autocommand events that triggers the query. Default:
220+ `{"BufWritePost", "InsertEnter", "BufReadPost"}`; - `run_on_register` : whether
221+ to run the query when the buffer is registered. Default: `false` ; -
222+ `single_job` : boolean. If this is set to `true` , there will only be one running
223223job for each buffer, and when a new job is triggered, the last-running job will
224224be cancelled. Default: `false` .
225225
@@ -232,10 +232,10 @@ This function queries VectorCode from cache.
232232 local query_results = cacher_backend.query_from_cache(0, {notify=false} )
233233<
234234
235- The following are the available options for this function: - `bufnr ` buffer
236- number. Default: current buffer; - `opts` accepts a lua table with the following
237- keys: - `notify` boolean, whether to show notifications when a query is
238- completed. Default: `false` ;
235+ The following are the available options for this function: - `bufnr ` : buffer
236+ number. Default: current buffer; - `opts` : accepts a lua table with the
237+ following keys: - `notify` : boolean, whether to show notifications when a query
238+ is completed. Default: `false` ;
239239
240240Return value: an array of results. Each item of the array is in the format of
241241`{path="path/to/your/code.lua", document="document content"}`.
@@ -254,17 +254,18 @@ project.
254254 )
255255<
256256
257- The following are the available options for this function: - `check_item` any
257+ The following are the available options for this function: - `check_item` : any
258258check that works with `vectorcode check` command. If not set, it defaults to
259- `" config" ` ; - `on_success` a callback function that is called when the check
260- passes; - `on_failure` a callback function that is called when the check fails.
259+ `" config" ` ; - `on_success` : a callback function that is called when the check
260+ passes; - `on_failure` : a callback function that is called when the check
261+ fails.
261262
262263
263264CACHER_BACKEND.BUF_IS_REGISTERED(BUFNR?) ~
264265
265266This function checks if a buffer has been registered with VectorCode.
266267
267- The following are the available options for this function: - `bufnr ` buffer
268+ The following are the available options for this function: - `bufnr ` : buffer
268269number. Default: current buffer. Return value: `true` if registered, `false`
269270otherwise.
270271
@@ -276,7 +277,7 @@ slightly different from `buf_is_registered`, because it does not guarantee
276277VectorCode is actively caching the content of the buffer. It is the same as
277278`buf_is_registered && not is_paused`.
278279
279- The following are the available options for this function: - `bufnr ` buffer
280+ The following are the available options for this function: - `bufnr ` : buffer
280281number. Default: current buffer. Return value: `true` if enabled, `false`
281282otherwise.
282283
@@ -288,8 +289,8 @@ Returns the number of running jobs in the background.
288289
289290CACHER_BACKEND.MAKE_PROMPT_COMPONENT(BUFNR?, COMPONENT_CB?) ~
290291
291- Compile the retrieval results into a string. Parameters: - `bufnr ` buffer
292- number. Default: current buffer; - `component_cb` a callback function that
292+ Compile the retrieval results into a string. Parameters: - `bufnr ` : buffer
293+ number. Default: current buffer; - `component_cb` : a callback function that
293294formats each retrieval result, so that you can customise the control token,
294295etc. for the component. The default is the following:
295296
@@ -299,8 +300,8 @@ etc. for the component. The default is the following:
299300 end
300301<
301302
302- `make_prompt_component` returns a table with 2 keys: - `count ` number of
303- retrieved documents; - `content` The retrieval results concatenated together
303+ `make_prompt_component` returns a table with 2 keys: - `count ` : number of
304+ retrieved documents; - `content` : The retrieval results concatenated together
304305into a string. Each result is formatted by `component_cb` .
305306
306307
@@ -311,15 +312,15 @@ takes the buffer ID as the only parameter, and return a string or a list of
311312strings. The `vectorcode.utils` module provides the following callback
312313constructor for you to play around with it, but you can easily build your own!
313314
314- - `require (" vectorcode.utils" ).make_surrounding_lines_cb (line_count)` returns a
315+ - `require (" vectorcode.utils" ).make_surrounding_lines_cb (line_count)` : returns a
315316 callback that uses `line_count` lines around the cursor as the query. When
316317 `line_count` is negative, it uses the full buffer;
317- - `require (" vectorcode.utils" ).make_lsp_document_symbol_cb ()` returns a
318+ - `require (" vectorcode.utils" ).make_lsp_document_symbol_cb ()` : returns a
318319 callback which uses the `textDocument/documentSymbol` method to retrieve a
319320 list of symbols in the current document. This will fallback to
320321 `make_surrounding_lines_cb (-1 )` when there’s no LSP that supports the
321322 `documentSymbol` method;
322- - `require (" vectorcode.utils" ).make_changes_cb (max_num)` returns a callback
323+ - `require (" vectorcode.utils" ).make_changes_cb (max_num)` : returns a callback
323324 that fetches `max_num` unique items from the `:changes ` list. This will also
324325 fallback to `make_surrounding_lines_cb (-1 )` . The default value for `max_num`
325326 is 50.
0 commit comments