Skip to content

Commit 2d864ea

Browse files
committed
Update custom command template to support {{clipboard}}
1 parent 6f970de commit 2d864ea

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Core/Sources/ChatService/CustomCommandTemplateProcessor.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import AppKit
12
import Foundation
23
import SuggestionModel
34
import XcodeInspector
@@ -22,6 +23,10 @@ struct CustomCommandTemplateProcessor {
2223
of: "{{active_editor_file_name}}",
2324
with: info.documentURL?.lastPathComponent ?? ""
2425
)
26+
.replacingOccurrences(
27+
of: "{{clipboard}}",
28+
with: NSPasteboard.general.string(forType: .string) ?? ""
29+
)
2530
return updatedText
2631
}
2732

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ Copilot for Xcode is an Xcode Source Editor Extension that provides GitHub Copil
2525
- [Granting Permissions to the App](#granting-permissions-to-the-app)
2626
- [Setting Up Key Bindings](#setting-up-key-bindings)
2727
- [Setting Up Suggestion Feature](#setting-up-suggestion-feature)
28-
- [Setting Up GitHub Copilot](#setting-up-github-copilot)
29-
- [Setting Up Codeium](#setting-up-codeium)
28+
- [Setting Up GitHub Copilot](#setting-up-github-copilot)
29+
- [Setting Up Codeium](#setting-up-codeium)
3030
- [Setting Up Chat Feature](#setting-up-chat-feature)
3131
- [Managing `CopilotForXcodeExtensionService.app`](#managing-copilotforxcodeextensionserviceapp)
3232
- [Update](#update)
@@ -129,11 +129,11 @@ Another convenient method to access commands is by using the `⇧⌘/` shortcut
129129
1. In the host app, navigate to "Service - GitHub Copilot" to access your GitHub Copilot account settings.
130130
2. Click on "Install" to install the language server.
131131
3. Optionally, set up the path to Node. The default value is simply `node`. Copilot for Xcode.app will attempt to locate Node from the following directories: `/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`.
132-
133-
If your Node installation is located elsewhere, you can run `which node` from the terminal to obtain the correct path.
134-
135-
If you are using a node version manager that provides a shim executable, you will need to find the path to the actual executable. Please refer to the FAQ for more information.
136-
132+
133+
If your Node installation is located elsewhere, you can run `which node` from the terminal to obtain the correct path.
134+
135+
If you are using a node version manager that provides a shim executable, you will need to find the path to the actual executable. Please refer to the FAQ for more information.
136+
137137
4. Click on "Sign In", and you will be redirected to a verification website provided by GitHub. A user code will be copied to your clipboard.
138138
5. After signing in, return to the app and click on "Confirm Sign-in" to complete the process.
139139
6. Go to "Feature - Suggestion" and update the feature provider to "GitHub Copilot".
@@ -235,7 +235,7 @@ You can detach the chat panel by simply dragging it away. Once detached, the cha
235235
| :------: | --------------------------------------------------------------------------------------------------- |
236236
| `⌘W` | Close the chat tab. |
237237
| `⌘M` | Minimize the chat, you can bring it back with any chat commands or by clicking the circular widget. |
238-
| `⇧↩︎` | Add new line. |
238+
| `⇧↩︎` | Add new line. |
239239
| `⇧⌘]` | Move to next tab |
240240
| `⇧⌘[` | Move to previous tab |
241241

@@ -297,7 +297,7 @@ This feature is recommended when you need to update a specific piece of code. So
297297
#### Commands
298298

299299
- Prompt to Code: Open a prompt to code window, where you can use natural language to write or edit selected code.
300-
- Accept Prompt to Code: Accept the result of prompt to code.
300+
- Accept Prompt to Code: Accept the result of prompt to code.
301301

302302
### Custom Commands
303303

@@ -316,6 +316,7 @@ For Send Message, Single Round Dialog and Custom Chat commands, you can use the
316316
| `{{active_editor_language}}` | The programming language of the active editor. |
317317
| `{{active_editor_file_url}}` | The URL of the active file in the editor. |
318318
| `{{active_editor_file_name}}` | The name of the active file in the editor. |
319+
| `{{clipboard}}` | The content in clipboard |
319320

320321
## Plus Features
321322

0 commit comments

Comments
 (0)