Skip to content

Commit 82b562b

Browse files
committed
Pre-release 0.45.154
1 parent 65e54a8 commit 82b562b

39 files changed

+1038
-967
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
blank_issues_enabled: false
22
contact_links:
33
- name: Questions
4-
url: https://github.com/orgs/community/discussions/categories/copilot
4+
url: https://github.com/github/CopilotForXcode/discussions
55
about: Please ask and answer questions about GitHub Copilot here

.github/workflows/auto-close-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
gh pr close ${{ github.event.pull_request.number }} --comment \
1515
"At the moment we are not accepting contributions to the repository.
1616
17-
Feedback for GitHub Copilot for Xcode can be given in the [Copilot community discussions](https://github.com/orgs/community/discussions/categories/copilot)."
17+
Feedback for GitHub Copilot for Xcode can be given in the [Copilot community discussions](https://github.com/github/CopilotForXcode/discussions)."
1818
env:
1919
GH_REPO: ${{ github.repository }}
2020
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Config.debug.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ EXTENSION_BUNDLE_NAME = GitHub Copilot Dev
1010
EXTENSION_BUNDLE_DISPLAY_NAME = GitHub Copilot Dev
1111
EXTENSION_SERVICE_NAME = GitHub Copilot for Xcode Extension
1212
COPILOT_DOCS_URL = https:$(SLASH)$(SLASH)docs.github.com/en/copilot
13-
COPILOT_FORUM_URL = https:$(SLASH)$(SLASH)github.com/orgs/community/discussions/categories/copilot
13+
COPILOT_FORUM_URL = https:$(SLASH)$(SLASH)github.com/github/CopilotForXcode/discussions
1414

1515
// see also target Configs
1616

Config.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ EXTENSION_BUNDLE_NAME = GitHub Copilot
1010
EXTENSION_BUNDLE_DISPLAY_NAME = GitHub Copilot
1111
EXTENSION_SERVICE_NAME = GitHub Copilot for Xcode Extension
1212
COPILOT_DOCS_URL = https:$(SLASH)$(SLASH)docs.github.com/en/copilot
13-
COPILOT_FORUM_URL = https:$(SLASH)$(SLASH)github.com/orgs/community/discussions/categories/copilot
13+
COPILOT_FORUM_URL = https:$(SLASH)$(SLASH)github.com/github/CopilotForXcode/discussions
1414

1515
// see also target Configs

Core/Sources/ChatService/ToolCalls/InsertEditIntoFileTool.swift

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ public class InsertEditIntoFileTool: ICopilotTool {
8989
contextProvider: any ToolContextProvider,
9090
xcodeInstance: AppInstanceInspector
9191
) throws -> String {
92+
Thread.sleep(forTimeInterval: 0.5)
9293
// Get the focused element directly from the app (like XcodeInspector does)
93-
guard let focusedElement: AXUIElement = try? xcodeInstance.appElement.copyValue(key: kAXFocusedUIElementAttribute)
94+
guard let focusedElement: AXUIElement = xcodeInstance.appElement.focusedElement
9495
else {
9596
throw NSError(domain: "Failed to access xcode element", code: 0)
9697
}
@@ -113,9 +114,6 @@ public class InsertEditIntoFileTool: ICopilotTool {
113114

114115
let lines = value.components(separatedBy: .newlines)
115116

116-
var isInjectedSuccess = false
117-
var injectionError: Error?
118-
119117
do {
120118
try AXHelper().injectUpdatedCodeWithAccessibilityAPI(
121119
.init(
@@ -128,33 +126,24 @@ public class InsertEditIntoFileTool: ICopilotTool {
128126
.inserted(0, [content])
129127
]
130128
),
131-
focusElement: editorElement,
132-
onSuccess: {
133-
Logger.client.info("Content injection succeeded")
134-
isInjectedSuccess = true
135-
},
136-
onError: {
137-
Logger.client.error("Content injection failed in onError callback")
138-
}
129+
focusElement: editorElement
139130
)
140131
} catch {
141-
Logger.client.error("Content injection threw error: \(error)")
142-
if let axError = error as? AXError {
143-
Logger.client.error("AX Error code during injection: \(axError.rawValue)")
144-
}
145-
injectionError = error
132+
Logger.client.error("Failed to inject code for insert edit into file: \(error.localizedDescription)")
133+
throw error
146134
}
147135

148-
if !isInjectedSuccess {
149-
let errorMessage = injectionError?.localizedDescription ?? "Failed to apply edit"
150-
Logger.client.error("Edit application failed: \(errorMessage)")
151-
throw NSError(domain: "Failed to apply edit: \(errorMessage)", code: 0)
136+
guard let refreshedFocusedElement: AXUIElement = xcodeInstance.appElement.focusedElement,
137+
let refreshedEditorElement = refreshedFocusedElement.findSourceEditorElement()
138+
else {
139+
throw NSError(domain: "Failed to access xcode element", code: 0)
152140
}
153141

154142
// Verify the content was applied by reading it back
155143
do {
156-
let newContent: String = try editorElement.copyValue(key: kAXValueAttribute)
144+
let newContent: String = try refreshedEditorElement.copyValue(key: kAXValueAttribute)
157145
Logger.client.info("Successfully read back new content, length: \(newContent.count)")
146+
158147
return newContent
159148
} catch {
160149
Logger.client.error("Failed to read back new content: \(error)")
@@ -194,6 +183,7 @@ public class InsertEditIntoFileTool: ICopilotTool {
194183
)
195184

196185
Task {
186+
await WorkspaceInvocationCoordinator().invokeFilespaceUpdate(fileURL: fileURL, content: newContent)
197187
if let completion = completion { completion(newContent, nil) }
198188
}
199189
} catch {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import Foundation
2+
import Workspace
3+
import Dependencies
4+
5+
struct WorkspaceInvocationCoordinator {
6+
@Dependency(\.workspaceInvoker) private var workspaceInvoker
7+
8+
func invokeFilespaceUpdate(fileURL: URL, content: String) async {
9+
await workspaceInvoker.invokeFilespaceUpdate(fileURL, content)
10+
}
11+
}

Core/Sources/HostApp/GeneralSettings/CopilotConnectionView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct CopilotConnectionView: View {
120120
)
121121
Divider()
122122
SettingsLink(
123-
url: "https://github.com/orgs/community/discussions/categories/copilot",
123+
url: "https://github.com/github/CopilotForXcode/discussions",
124124
title: "View Copilot Feedback Forum"
125125
)
126126
}

Core/Sources/HostApp/ToolsSettings/CopilotMCPToolManagerObservable.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ class CopilotMCPToolManagerObservable: ObservableObject {
5252
let totalToolsCount = tools.reduce(0) { $0 + $1.tools.count }
5353
let serverNames = tools.map { $0.name }.joined(separator: ", ")
5454
Logger.client.info("Refreshed MCP tools - Servers: \(tools.count), Total tools: \(totalToolsCount), Server names: [\(serverNames)]")
55-
56-
AppState.shared.cleanupMCPToolsStatus(availableTools: tools)
57-
AppState.shared.createMCPToolsStatus(tools)
55+
5856
self.availableMCPServerTools = tools
5957
}
6058
}

Core/Sources/HostApp/ToolsSettings/MCPAppState.swift

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)