Skip to content

Commit cf4f7a5

Browse files
refactor(functions)!: unify buffer/selection/diagnostics resources (#1456)
* refactor(functions)!: unify buffer/selection/diagnostics resources - Replace separate `buffer`, `buffers`, `selection`, `diagnostics` and 'quickfix' resources with a unified `buffer` and `selection` resource that automatically includes diagnostics in the output. - Replace `register` resource with simplified `clipboard` resource - Add new `bash` and `edit` tools for LLM-only usage. - Update README to reflect new resource/tool types and usage. - Remove unused/duplicated mappings and code for old resources. - Improve enum handling and selection UI for resource schemas. BREAKING CHANGE: Removes `buffers`, `diagnostics`, `register`, and `quickfix` resources. Use `buffer`, `selection`, or `clipboard` instead. Signed-off-by: Tomas Slusny <[email protected]> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Tomas Slusny <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 1e06be9 commit cf4f7a5

File tree

4 files changed

+303
-371
lines changed

4 files changed

+303
-371
lines changed

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ EOF
110110

111111
# Sticky prompt that persists
112112

113-
> #buffer:current
113+
> #buffer:active
114114
> You are a helpful coding assistant
115115
```
116116

117-
When you use `@copilot`, the LLM can call functions like `glob`, `file`, `gitdiff` etc. You'll see the proposed function call and can approve/reject it before execution.
117+
When you use `@copilot`, the LLM can call functions like `bash`, `edit`, `file`, `glob`, `grep`, `gitdiff` etc. You'll see the proposed function call and can approve/reject it before execution.
118118

119119
# Usage
120120

@@ -143,7 +143,6 @@ When you use `@copilot`, the LLM can call functions like `glob`, `file`, `gitdif
143143
| `<C-l>` | `<C-l>` | Reset and clear the chat window |
144144
| `<C-s>` | `<CR>` | Submit the current prompt |
145145
| - | `grr` | Toggle sticky prompt for line under cursor |
146-
| - | `grx` | Clear all sticky prompts in prompt |
147146
| `<C-y>` | `<C-y>` | Accept nearest diff |
148147
| - | `gj` | Jump to section of nearest diff |
149148
| - | `gqa` | Add all answers from chat to quickfix list |
@@ -168,20 +167,23 @@ When you use `@copilot`, the LLM can call functions like `glob`, `file`, `gitdif
168167
169168
All predefined functions belong to the `copilot` group.
170169
171-
| Function | Description | Example Usage |
172-
| ------------- | ------------------------------------------------ | ---------------------- |
173-
| `buffer` | Retrieves content from a specific buffer | `#buffer` |
174-
| `buffers` | Fetches content from multiple buffers | `#buffers:visible` |
175-
| `diagnostics` | Collects code diagnostics (errors, warnings) | `#diagnostics:current` |
176-
| `file` | Reads content from a specified file path | `#file:path/to/file` |
177-
| `gitdiff` | Retrieves git diff information | `#gitdiff:staged` |
178-
| `gitstatus` | Retrieves git status information | `#gitstatus` |
179-
| `glob` | Lists filenames matching a pattern in workspace | `#glob:**/*.lua` |
180-
| `grep` | Searches for a pattern across files in workspace | `#grep:TODO` |
181-
| `quickfix` | Includes content of files in quickfix list | `#quickfix` |
182-
| `register` | Provides access to specified Vim register | `#register:+` |
183-
| `selection` | Includes the current visual selection | `#selection` |
184-
| `url` | Fetches content from a specified URL | `#url:https://...` |
170+
| Function | Type | Description | Example Usage |
171+
| ----------- | -------- | ------------------------------------------------------ | -------------------- |
172+
| `bash` | Tool | Executes a bash command and returns output | `@copilot` only |
173+
| `buffer` | Resource | Retrieves content from buffer(s) with diagnostics | `#buffer:active` |
174+
| `clipboard` | Resource | Provides access to system clipboard content | `#clipboard` |
175+
| `edit` | Tool | Applies a unified diff to a file | `@copilot` only |
176+
| `file` | Resource | Reads content from a specified file path | `#file:path/to/file` |
177+
| `gitdiff` | Resource | Retrieves git diff information | `#gitdiff:staged` |
178+
| `glob` | Resource | Lists filenames matching a pattern in workspace | `#glob:**/*.lua` |
179+
| `grep` | Resource | Searches for a pattern across files in workspace | `#grep:TODO` |
180+
| `selection` | Resource | Includes the current visual selection with diagnostics | `#selection` |
181+
| `url` | Resource | Fetches content from a specified URL | `#url:https://...` |
182+
183+
**Type Legend:**
184+
185+
- **Resource**: Can be used manually via `#function` syntax
186+
- **Tool**: Can only be called by LLM via `@copilot` (for safety/complexity reasons)
185187
186188
## Predefined Prompts
187189

0 commit comments

Comments
 (0)