Skip to content

Commit 6ad2ead

Browse files
committed
Merge tag '0.24.0' into develop
2 parents 91ff0eb + 151776f commit 6ad2ead

20 files changed

Lines changed: 108 additions & 54 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,4 @@ Python/site-packages/*
133133

134134
Python/VERSIONS
135135
Copilot for Xcode Plus.xcworkspace
136+
PLUS

Copilot for Xcode.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Core/Package.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,14 +405,18 @@ func isProIncluded(file: StaticString = #file) -> Bool {
405405
let rootURL = fileURL
406406
.deletingLastPathComponent()
407407
.deletingLastPathComponent()
408-
let folderURL = rootURL.appendingPathComponent("Pro")
409-
if !FileManager.default.fileExists(atPath: folderURL.path) {
408+
let confURL = rootURL.appendingPathComponent("PLUS")
409+
if !FileManager.default.fileExists(atPath: confURL.path) {
410410
return false
411411
}
412-
let packageManifestURL = folderURL.appendingPathComponent("Package.swift")
413-
if !FileManager.default.fileExists(atPath: packageManifestURL.path) {
412+
do {
413+
let content = String(
414+
data: try Data(contentsOf: confURL),
415+
encoding: .utf8
416+
)
417+
return content?.hasPrefix("YES") ?? false
418+
} catch {
414419
return false
415420
}
416-
return true
417421
}
418422

Core/Sources/ChatGPTChatTab/ChatPanel.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ private struct Instruction: View {
132132
| `@file` | Read the metadata of the editing file |
133133
| `@code` | Read the code and metadata in the editing file |
134134
| `@web` (beta) | Search on Bing or query from a web page |
135+
| `@project` | Experimental. Access content of the project |
135136
136137
To use scopes, you can prefix a message with `@code`.
137138

Core/Sources/ChatService/AllContextCollector.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@ import ActiveDocumentChatContextCollector
22
import ChatContextCollector
33
import SystemInfoChatContextCollector
44
import WebChatContextCollector
5+
#if canImport(ProChatContextCollectors)
56
import ProChatContextCollectors
6-
77
let allContextCollectors: [any ChatContextCollector] = [
88
SystemInfoChatContextCollector(),
99
ActiveDocumentChatContextCollector(),
1010
WebChatContextCollector(),
1111
ProChatContextCollectors(),
1212
]
13+
#else
14+
let allContextCollectors: [any ChatContextCollector] = [
15+
SystemInfoChatContextCollector(),
16+
ActiveDocumentChatContextCollector(),
17+
WebChatContextCollector(),
18+
]
19+
#endif
1320

Core/Sources/HostApp/DebugView.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ final class DebugSettings: ObservableObject {
1515
@AppStorage(\.disableGitHubCopilotSettingsAutoRefreshOnAppear)
1616
var disableGitHubCopilotSettingsAutoRefreshOnAppear
1717
@AppStorage(\.useUserDefaultsBaseAPIKeychain) var useUserDefaultsBaseAPIKeychain
18+
@AppStorage(\.disableEnhancedWorkspace) var disableEnhancedWorkspace
1819
init() {}
1920
}
2021

@@ -59,6 +60,10 @@ struct DebugSettingsView: View {
5960
Text("Store API keys in UserDefaults")
6061
}
6162

63+
Toggle(isOn: $settings.disableEnhancedWorkspace) {
64+
Text("Disable Enhanced Workspace")
65+
}
66+
6267
Button("Reset Migration Version to 0") {
6368
UserDefaults.shared.set(nil, forKey: "OldMigrationVersion")
6469
}

Core/Sources/Service/Service.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public final class Service {
2828

2929
private init() {
3030
@Dependency(\.workspacePool) var workspacePool
31-
31+
3232
scheduledCleaner = .init(workspacePool: workspacePool, guiController: guiController)
3333
#if canImport(KeyBindingManager)
3434
keyBindingManager = .init(
@@ -43,9 +43,11 @@ public final class Service {
4343

4444
workspacePool.registerPlugin { SuggestionServiceWorkspacePlugin(workspace: $0) }
4545
#if canImport(EnhancedWorkspace)
46-
workspacePool.registerPlugin { EnhancedWorkspacePlugin(workspace: $0) }
46+
if !UserDefaults.shared.value(for: \.disableEnhancedWorkspace) {
47+
workspacePool.registerPlugin { EnhancedWorkspacePlugin(workspace: $0) }
48+
}
4749
#endif
48-
50+
4951
self.workspacePool = workspacePool
5052
}
5153

Core/Sources/Service/SuggestionCommandHandler/WindowBaseCommandHandler.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ extension WindowBaseCommandHandler {
410410
let viewStore = Service.shared.guiController.viewStore
411411

412412
_ = await Task { @MainActor in
413-
viewStore.send(.promptToCodeGroup(.createPromptToCode(.init(
413+
// if there is already a prompt to code presenting, we should not present another one
414+
viewStore.send(.promptToCodeGroup(.activateOrCreatePromptToCode(.init(
414415
code: code,
415416
selectionRange: selection,
416417
language: codeLanguage,

Core/Sources/SuggestionWidget/FeatureReducers/PanelFeature.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public struct PanelFeature: ReducerProtocol {
114114
state.content.suggestion = nil
115115
return .none
116116

117-
case .sharedPanel(.promptToCodeGroup(.createPromptToCode)):
117+
case .sharedPanel(.promptToCodeGroup(.activateOrCreatePromptToCode)),
118+
.sharedPanel(.promptToCodeGroup(.createPromptToCode)):
118119
let hasPromptToCode = state.content.promptToCode != nil
119120
return .run { send in
120121
await send(.displayPanelContent)

Core/Sources/SuggestionWidget/FeatureReducers/PromptToCodeGroup.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ public struct PromptToCodeGroup: ReducerProtocol {
6767
}
6868

6969
public enum Action: Equatable {
70+
/// Activate the prompt to code if it exists or create it if it doesn't
71+
case activateOrCreatePromptToCode(PromptToCodeInitialState)
7072
case createPromptToCode(PromptToCodeInitialState)
7173
case updatePromptToCodeRange(id: PromptToCode.State.ID, range: CursorRange)
7274
case discardAcceptedPromptToCodeIfNotContinuous(id: PromptToCode.State.ID)
@@ -80,6 +82,13 @@ public struct PromptToCodeGroup: ReducerProtocol {
8082
public var body: some ReducerProtocol<State, Action> {
8183
Reduce { state, action in
8284
switch action {
85+
case let .activateOrCreatePromptToCode(s):
86+
guard state.activePromptToCode == nil else {
87+
return .none
88+
}
89+
return .run { send in
90+
await send(.createPromptToCode(s))
91+
}
8392
case let .createPromptToCode(s):
8493
let newPromptToCode = PromptToCode.State(
8594
code: s.code,

0 commit comments

Comments
 (0)