|
1 | | -*VectorCode.txt* For Last change: 2025 March 28 |
| 1 | +*VectorCode.txt* For Last change: 2025 March 29 |
2 | 2 |
|
3 | 3 | ============================================================================== |
4 | 4 | Table of Contents *VectorCode-table-of-contents* |
@@ -40,6 +40,7 @@ Table of Contents *VectorCode-table-of-contents* |
40 | 40 | - |VectorCode-`cacher_backend.buf_is_enabled(bufnr?)`| |
41 | 41 | - |VectorCode-`cacher_backend.buf_job_count(bufnr?)`| |
42 | 42 | - |VectorCode-`cacher_backend.make_prompt_component(bufnr?,-component_cb?)`| |
| 43 | + - |VectorCode-built-in-query-callbacks| |
43 | 44 |
|
44 | 45 |
|
45 | 46 | INSTALLATION *VectorCode-neovim-plugin-installation* |
@@ -383,8 +384,9 @@ documents. Default: `1`; - `debounce`: debounce time in milliseconds. Default: |
383 | 384 | `10`; - `notify`: whether to show notifications when a query is completed. |
384 | 385 | Default: `false`; - `query_cb`: a callback function that accepts the buffer ID |
385 | 386 | and returns the query message(s). Default: |
386 | | -`require("vectorcode.utils").make_surrounding_lines_cb(-1)`; - `events`: list |
387 | | -of autocommand events that triggers the query. Default: `{"BufWritePost", |
| 387 | +`require("vectorcode.utils").make_surrounding_lines_cb(-1)`. See |
| 388 | +|VectorCode-this-section| for a list of built-in query callbacks; - `events`: |
| 389 | +list of autocommand events that triggers the query. Default: `{"BufWritePost", |
388 | 390 | "InsertEnter", "BufReadPost"}`; - `run_on_register`: whether to run the query |
389 | 391 | when the buffer is registered. Default: `false`; - `single_job`: boolean. If |
390 | 392 | this is set to `true`, there will only be one running job for each buffer, and |
@@ -472,6 +474,27 @@ etc. for the component. The default is the following: |
472 | 474 | retrieved documents; - `content`: The retrieval results concatenated together |
473 | 475 | into a string. Each result is formatted by `component_cb`. |
474 | 476 |
|
| 477 | + |
| 478 | +BUILT-IN QUERY CALLBACKS |
| 479 | + |
| 480 | +When using async cache, the query message is constructed by a function that |
| 481 | +takes the buffer ID as the only parameter, and return a string or a list of |
| 482 | +strings. The `vectorcode.utils` module provides the following callback |
| 483 | +constructor for you to play around with it, but you can easily build your own! |
| 484 | + |
| 485 | +- `require("vectorcode.utils").make_surrounding_lines_cb(line_count)`: returns a |
| 486 | + callback that uses `line_count` lines around the cursor as the query. When |
| 487 | + `line_count` is negative, it uses the full buffer; |
| 488 | +- `require("vectorcode.utils").make_lsp_document_symbol_cb()`: returns a |
| 489 | + callback which uses the `textDocument/documentSymbol` method to retrieve a |
| 490 | + list of symbols in the current document. This will fallback to |
| 491 | + `make_surrounding_lines_cb(-1)` when there’s no LSP that supports the |
| 492 | + `documentSymbol` method; |
| 493 | +- `require("vectorcode.utils").make_changes_cb(max_num)`: returns a callback |
| 494 | + that fetches `max_num` unique items from the `:changes` list. This will also |
| 495 | + fallback to `make_surrounding_lines_cb(-1)`. The default value for `max_num` |
| 496 | + is 50. |
| 497 | + |
475 | 498 | Generated by panvimdoc <https://github.com/kdheepak/panvimdoc> |
476 | 499 |
|
477 | 500 | vim:tw=78:ts=8:noet:ft=help:norl: |
0 commit comments