New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: add support for Codeium chat #485
base: main
Are you sure you want to change the base?
Conversation
@@ -27,6 +27,15 @@ | |||
"version" : "1.0.2" | |||
} | |||
}, | |||
{ | |||
"identity" : "generative-ai-swift", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do these changes do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Package.resolved file is updated because I mostly develop in another workspace. Maybe it's better to just uncheck the file for this pull request if no dependency is added?
Wow, I was also planning to do this in the next phase when the chat feature is upgraded, but pull requests are always welcomed. Do you mind explaining how Codeium chat will be integrated in this pull request? |
Kevin from the Codeium team here. We are going to be bringing Codeium Chat to Xcode! @etaldot is implementing this right now and will be opening PRs in the next week. How it works at a high level:
Let me know if you have other questions! We're excited to be releasing this soon 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@intitni I left a question. Any help would be awesome. Looking forward to contribute to this!
@@ -35,6 +35,10 @@ public protocol XPCServiceProtocol { | |||
editorContent: Data, | |||
withReply reply: @escaping (Data?, Error?) -> Void | |||
) | |||
func openChat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@intitni one question. I want to show this command only if codeium is setup to open chat. Additionally, I want to be able to call this directly. Right now it goes through the XPCService to get API keys etc, do you know of a better way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reuse the ChatWithSelectionCommand
and handle it in the service target. This command is named Open Chat but the type name was unchanged back then.
If you want to call a command programmatically, please use XcodeInspector.shared.safe.latestActiveXcode?.triggerCopilotCommand(name: "command name")
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what do you mean by service target @intitni ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest adding a picker in the chat settings to allow users to select what the open chat command will do. And handle it in
func chatWithSelection(editor: EditorContent)
in WindowBaseCommandHandler.swift.It's just not recommended to add dynamic items to the Xcode menu because it can't be refreshed until Xcode is restarted.
I mean this.
e8187c0
to
d0a79c6
Compare
@@ -35,6 +35,10 @@ public protocol XPCServiceProtocol { | |||
editorContent: Data, | |||
withReply reply: @escaping (Data?, Error?) -> Void | |||
) | |||
func openChat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please reuse the ChatWithSelectionCommand
and handle it in the service target. This command is named Open Chat but the type name was unchanged back then.
If you want to call a command programmatically, please use XcodeInspector.shared.safe.latestActiveXcode?.triggerCopilotCommand(name: "command name")
.
@@ -47,6 +47,7 @@ public protocol SuggestionServiceProvider { | |||
func notifyChangeTextDocument(fileURL: URL, content: String) async throws | |||
func notifyCloseTextDocument(fileURL: URL) async throws | |||
func notifySaveTextDocument(fileURL: URL) async throws | |||
func openChat() async throws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please handle the openChat
in a different place. SuggestionProvider is for suggestions only. If the code is too hard to reach, you can use NotificationCenter
to post a notification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I added this as a separate command called open chat rather than chat with selection was to distinguish between chatting with ChatGPT vs Codeium Chat. Can you explain further how would this look like if I were to move this out @intitni
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest adding a picker in the chat settings to allow users to select what the open chat command will do. And handle it in func chatWithSelection(editor: EditorContent)
in WindowBaseCommandHandler.swift.
It's just not recommended to add dynamic items to the Xcode menu because it can't be refreshed until Xcode is restarted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also found that the openChat method is added to SuggestionWorkspacePlugin.swift, Please create a CodeiumWorkspacePlugin.swift
and register it in Service.swift
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there is no API suitable for accessing the CodeiumService in another workspace plugin at the moment. Let's keep the changes in SuggestionProvider/WorkspacePlugin in this pr and only change the command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@intitni just to be clear, you are suggesting continuing to use the suggestion service but only change the command to use ChatWithSelection with a toggle that allows users to either use github copilot or codeium as a chat method correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct.
either use github copilot or codeium as a chat method
Please use words like builtin instead of GitHub Copilot because we don't support GitHub Copilot chat at all.
No description provided.