Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
bb5d1fd
Merge tag '0.33.4' into develop
intitni Jun 18, 2024
f90f0dc
Prevent re-parsing markdown on scroll
intitni Jun 19, 2024
2a44f1f
Merge branch 'feature/prevent-reevaluating-md-content' into develop
intitni Jun 19, 2024
6b58a40
Bump Copilot.vim to 1.37.0
intitni Jun 22, 2024
1779634
Merge branch 'feature/fix-github-copilot-signout' into develop
intitni Jun 22, 2024
d456d58
Update CopilotForXcodeKit
intitni Jun 22, 2024
e0b2687
Support presenting suggestion error when needed
intitni Jun 22, 2024
1c7bf5e
Merge branch 'feature/present-suggestion-service-errors' into develop
intitni Jun 22, 2024
404c64b
Expose the error
intitni Jun 28, 2024
9a52e0d
Bump version to 0.33.5
intitni Jun 28, 2024
ecd711f
Rename TMPDIR to RELEASEDIR to avoid conflict
intitni Jun 28, 2024
1926da3
Update appcast file location
intitni Jun 28, 2024
38de4bc
Remove unused content
intitni Jun 28, 2024
9fd0312
Add extension identifier to builtin extensions
intitni May 30, 2024
8f94fd6
Add naive implementation of GitHubCopilotChatService
intitni Jun 27, 2024
f7c0cc0
Move chat related models to ChatBasic
intitni Jun 28, 2024
6101a44
Bump CopilotForXcodeKit to 0.7.2
intitni Jun 30, 2024
d8c5797
Add ServerNotificationHandler to handle notifications
intitni Jun 30, 2024
5475981
Support injecting notification handler from everywhere
intitni Jun 30, 2024
ae0f411
Add new request types
intitni Jun 30, 2024
250c54b
Add GitHubCopilotChatService
intitni Jun 30, 2024
4fdb4e5
Hack ChatGPTService to support GitHub copilot chat
intitni Jun 30, 2024
b2bcfc7
Add settings for GitHub Copilot chat
intitni Jun 30, 2024
6c03a20
Fix that the request may timeout too soon
intitni Jun 30, 2024
a7335af
Fix unit tests
intitni Jun 30, 2024
a315321
Merge branch 'feature/github-copilot-chat-experiments' into develop
intitni Jun 30, 2024
74eec7a
Added Indexing Changes for Codeium
RoshanNagaram-eng Jun 24, 2024
1e0ed33
Update preference keys names
intitni Jun 30, 2024
920bba7
Format files
intitni Jun 30, 2024
19fe95f
Fix naming style
intitni Jun 30, 2024
9d5e250
Merge branch 'feature/merging-codeium-indexing' into develop
intitni Jun 30, 2024
f255576
Update
intitni Jun 30, 2024
c3c097f
Bump build number
intitni Jun 30, 2024
7187424
Merge tag '0.33.5.beta' into develop
intitni Jun 30, 2024
57480f0
Rename SuggestionModel to SuggestionBasic
intitni Jul 1, 2024
7fbe123
Merge branch 'feature/rename-suggestion-model' into develop
intitni Jul 1, 2024
096569f
Add missing non-stream implemetation
intitni Jul 2, 2024
a2edca4
Add utility chat model
intitni Jul 2, 2024
3e59129
Update
intitni Jul 2, 2024
2d62073
Try to inject system prompt
intitni Jul 2, 2024
982a44d
Add GitHub Copilot chat (poc) to scope preferred models
intitni Jul 2, 2024
2882c24
Disable GitHub Copilot chat model for every place that requires a uti…
intitni Jul 2, 2024
a17e7f5
Bump build number
intitni Jul 2, 2024
348dc9a
Update appcast.xml
intitni Jul 2, 2024
1629510
Update LICENSE
intitni Jun 30, 2024
d80d931
Move KeybindingManager to Core
intitni Jul 2, 2024
c5f8f10
Move theme syncronization to Core
intitni Jul 2, 2024
f9d4913
Minor changes to make it build
intitni Jul 3, 2024
d6fcbe5
Update README.md
intitni Jul 3, 2024
1e57d8d
Remove debug logs
intitni Jul 3, 2024
ff96656
Merge branch 'feature/what-happened' into develop
intitni Jul 3, 2024
ade3d61
Merge branch 'main' into develop
intitni Jul 3, 2024
fe6b09f
Merge branch 'develop'
intitni Jul 3, 2024
6a60726
Update DEVELOPMENT.md
intitni Jul 3, 2024
72c41a1
Update README.md
intitni Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "Pro"]
path = Pro
url = git@github.com:intitni/CopilotForXcodePro.git
2 changes: 1 addition & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ SLASH = /

HOST_APP_NAME = Copilot for Xcode
BUNDLE_IDENTIFIER_BASE = com.intii.CopilotForXcode
SPARKLE_FEED_URL = https:$(SLASH)$(SLASH)raw.githubusercontent.com/intitni/CopilotForXcode/main/appcast.xml
SPARKLE_FEED_URL = https:$(SLASH)$(SLASH)copilotforxcode.intii.com/appcast.xml
SPARKLE_PUBLIC_KEY = WDzm5GHnc6c8kjeJEgX5GuGiPpW6Lc/ovGjLnrrZvPY=
APPLICATION_SUPPORT_FOLDER = com.intii.CopilotForXcode
EXTENSION_BUNDLE_NAME = Copilot
Expand Down
2 changes: 0 additions & 2 deletions Copilot for Xcode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@
C8216B772980370100AD38C7 /* ReloadLaunchAgent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReloadLaunchAgent.swift; sourceTree = "<group>"; };
C828B27D2B1F241500E7612A /* ExtensionPoint.appextensionpoint */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = ExtensionPoint.appextensionpoint; sourceTree = "<group>"; };
C82E38492A1F025F00D4EADF /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
C83E5DED2A38CD8C0071506D /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
C8520300293C4D9000460097 /* Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Helpers.swift; sourceTree = "<group>"; };
C8520308293D805800460097 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
C861A6A229E5503F005C41A3 /* PromptToCodeCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptToCodeCommand.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -335,7 +334,6 @@
C887BC832965D96000931567 /* DEVELOPMENT.md */,
C8520308293D805800460097 /* README.md */,
C82E38492A1F025F00D4EADF /* LICENSE */,
C83E5DED2A38CD8C0071506D /* Makefile */,
C8F103292A7A365000D28F4F /* launchAgent.plist */,
C8738B6D2BE4F3E800609E7F /* bridgeLaunchAgent.plist */,
C81E867D296FE4420026E908 /* Version.xcconfig */,
Expand Down
136 changes: 78 additions & 58 deletions Core/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,6 @@
import Foundation
import PackageDescription

// MARK: - Pro

extension [Target.Dependency] {
func pro(_ targetNames: [String]) -> [Target.Dependency] {
if isProIncluded {
// include the pro package
return self + targetNames.map { Target.Dependency.product(name: $0, package: "Pro") }
}
return self
}
}

extension [Package.Dependency] {
var pro: [Package.Dependency] {
if isProIncluded {
// include the pro package
return self + [.package(path: "../Pro/Pro")]
}
return self
}
}

let isProIncluded: Bool = {
func isProIncluded(file: StaticString = #file) -> Bool {
let filePath = "\(file)"
let fileURL = URL(fileURLWithPath: filePath)
let rootURL = fileURL
.deletingLastPathComponent()
.deletingLastPathComponent()
let confURL = rootURL.appendingPathComponent("PLUS")
if !FileManager.default.fileExists(atPath: confURL.path) {
return false
}
do {
if let content = try String(
data: Data(contentsOf: confURL),
encoding: .utf8
) {
if content.hasPrefix("YES") {
return true
}
}
return false
} catch {
return false
}
}

return isProIncluded()
}()

// MARK: - Package

let package = Package(
Expand Down Expand Up @@ -101,6 +50,8 @@ let package = Package(
// quick hack to support custom UserDefaults
// https://github.com/sindresorhus/KeyboardShortcuts
.package(url: "https://github.com/intitni/KeyboardShortcuts", branch: "main"),
.package(url: "https://github.com/intitni/CGEventOverride", from: "1.2.1"),
.package(url: "https://github.com/intitni/Highlightr", branch: "master"),
].pro,
targets: [
// MARK: - Main
Expand All @@ -110,7 +61,7 @@ let package = Package(
dependencies: [
.product(name: "XPCShared", package: "Tool"),
.product(name: "SuggestionProvider", package: "Tool"),
.product(name: "SuggestionModel", package: "Tool"),
.product(name: "SuggestionBasic", package: "Tool"),
.product(name: "Logger", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
].pro([
Expand All @@ -127,12 +78,14 @@ let package = Package(
"ServiceUpdateMigration",
"ChatGPTChatTab",
"PlusFeatureFlag",
"KeyBindingManager",
"XcodeThemeController",
.product(name: "XPCShared", package: "Tool"),
.product(name: "SuggestionProvider", package: "Tool"),
.product(name: "Workspace", package: "Tool"),
.product(name: "UserDefaultsObserver", package: "Tool"),
.product(name: "AppMonitoring", package: "Tool"),
.product(name: "SuggestionModel", package: "Tool"),
.product(name: "SuggestionBasic", package: "Tool"),
.product(name: "ChatTab", package: "Tool"),
.product(name: "Logger", package: "Tool"),
.product(name: "OpenAIService", package: "Tool"),
Expand All @@ -153,7 +106,7 @@ let package = Package(
"SuggestionInjector",
.product(name: "XPCShared", package: "Tool"),
.product(name: "SuggestionProvider", package: "Tool"),
.product(name: "SuggestionModel", package: "Tool"),
.product(name: "SuggestionBasic", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
]
),
Expand All @@ -169,7 +122,7 @@ let package = Package(
.product(name: "SuggestionProvider", package: "Tool"),
.product(name: "Toast", package: "Tool"),
.product(name: "SharedUIComponents", package: "Tool"),
.product(name: "SuggestionModel", package: "Tool"),
.product(name: "SuggestionBasic", package: "Tool"),
.product(name: "MarkdownUI", package: "swift-markdown-ui"),
.product(name: "OpenAIService", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
Expand All @@ -187,15 +140,15 @@ let package = Package(
dependencies: [
.product(name: "UserDefaultsObserver", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
.product(name: "SuggestionModel", package: "Tool"),
.product(name: "SuggestionBasic", package: "Tool"),
.product(name: "SuggestionProvider", package: "Tool")
].pro([
"ProExtension",
])
),
.target(
name: "SuggestionInjector",
dependencies: [.product(name: "SuggestionModel", package: "Tool")]
dependencies: [.product(name: "SuggestionBasic", package: "Tool")]
),
.testTarget(
name: "SuggestionInjectorTests",
Expand All @@ -208,7 +161,7 @@ let package = Package(
name: "PromptToCodeService",
dependencies: [
.product(name: "FocusedCodeFinder", package: "Tool"),
.product(name: "SuggestionModel", package: "Tool"),
.product(name: "SuggestionBasic", package: "Tool"),
.product(name: "OpenAIService", package: "Tool"),
.product(name: "AppMonitoring", package: "Tool"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
Expand Down Expand Up @@ -377,6 +330,73 @@ let package = Package(
],
path: "Sources/ChatContextCollectors/SystemInfoChatContextCollector"
),

// MARK: Key Binding

.target(
name: "KeyBindingManager",
dependencies: [
.product(name: "Workspace", package: "Tool"),
.product(name: "Preferences", package: "Tool"),
.product(name: "Logger", package: "Tool"),
.product(name: "CGEventOverride", package: "CGEventOverride"),
.product(name: "AppMonitoring", package: "Tool"),
.product(name: "UserDefaultsObserver", package: "Tool"),
]
),
.testTarget(
name: "KeyBindingManagerTests",
dependencies: ["KeyBindingManager"]
),

// MARK: Theming

.target(
name: "XcodeThemeController",
dependencies: [
.product(name: "Preferences", package: "Tool"),
.product(name: "AppMonitoring", package: "Tool"),
.product(name: "Highlightr", package: "Highlightr"),
]
),

]
)

extension [Target.Dependency] {
func pro(_ targetNames: [String]) -> [Target.Dependency] {
if isProIncluded {
// include the pro package
return self + targetNames.map { Target.Dependency.product(name: $0, package: "Pro") }
}
return self
}
}

extension [Package.Dependency] {
var pro: [Package.Dependency] {
if isProIncluded {
// include the pro package
return self + [.package(path: "../../CopilotForXcodePro/Pro")]
}
return self
}
}

let isProIncluded: Bool = {
func isProIncluded(file: StaticString = #file) -> Bool {
let filePath = "\(file)"
let fileURL = URL(fileURLWithPath: filePath)
let rootURL = fileURL
.deletingLastPathComponent()
.deletingLastPathComponent()
.deletingLastPathComponent()
let confURL = rootURL.appendingPathComponent("PLUS")
if !FileManager.default.fileExists(atPath: confURL.path) {
return false
}
return true
}

return isProIncluded()
}()
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ChatBasic
import Foundation
import LangChain
import OpenAIService
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import BingSearchService
import ChatBasic
import Foundation
import OpenAIService
import Preferences
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ChatBasic
import ChatContextCollector
import Foundation
import OpenAIService
Expand Down
15 changes: 10 additions & 5 deletions Core/Sources/ChatGPTChatTab/Chat.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import ChatBasic
import ChatService
import ComposableArchitecture
import Foundation
import MarkdownUI
import OpenAIService
import Preferences
import Terminal
Expand Down Expand Up @@ -40,12 +42,14 @@ public struct DisplayedChatMessage: Equatable {
public var id: String
public var role: Role
public var text: String
public var markdownContent: MarkdownContent
public var references: [Reference] = []

public init(id: String, role: Role, text: String, references: [Reference]) {
self.id = id
self.role = role
self.text = text
markdownContent = .init(text)
self.references = references
}
}
Expand Down Expand Up @@ -151,7 +155,7 @@ struct Chat {
case let .setIsEnabled(isEnabled):
state.isEnabled = isEnabled
return .none

case .sendButtonTapped:
guard !state.typedMessage.isEmpty else { return .none }
let message = state.typedMessage
Expand Down Expand Up @@ -213,11 +217,11 @@ struct Chat {
await openURL(url)
}
}

case .manuallyScrolledUp:
state.isPinnedToBottom = false
return .none

case .scrollToBottomButtonTapped:
state.isPinnedToBottom = true
return .none
Expand Down Expand Up @@ -248,7 +252,7 @@ struct Chat {
let debouncedHistoryChange = TimedDebounceFunction(duration: 0.2) {
await send(.historyChanged)
}

for await _ in stream {
await debouncedHistoryChange()
}
Expand Down Expand Up @@ -502,9 +506,10 @@ private actor TimedDebounceFunction {
}
}
}

func fire() async {
lastFireTime = Date()
await block()
}
}

Loading