Skip to content

Commit 6511f22

Browse files
committed
Fix building in Xcode 16
1 parent d89df81 commit 6511f22

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

Tool/Sources/GitHubCopilotService/Services/GitHubCopilotChatService.swift

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,23 @@ public final class GitHubCopilotChatService: BuiltinExtensionChatServiceType {
2626
let editorContent = await XcodeInspector.shared.getFocusedEditorContent()
2727
let workDoneToken = UUID().uuidString
2828
let turns = convertHistory(history: history, message: message)
29+
let doc = GitHubCopilotDoc(
30+
source: editorContent?.editorContent?.content ?? "",
31+
tabSize: 1,
32+
indentSize: 4,
33+
insertSpaces: true,
34+
path: editorContent?.documentURL.path ?? "",
35+
uri: editorContent?.documentURL.path ?? "",
36+
relativePath: editorContent?.relativePath ?? "",
37+
languageId: editorContent?.language ?? .plaintext,
38+
position: editorContent?.editorContent?.cursorPosition ?? .zero
39+
)
40+
2941
let request = GitHubCopilotRequest.ConversationCreate(requestBody: .init(
3042
workDoneToken: workDoneToken,
3143
turns: turns,
3244
capabilities: .init(allSkills: true, skills: []),
33-
doc: .init(
34-
source: editorContent?.editorContent?.content ?? "",
35-
tabSize: 1,
36-
indentSize: 4,
37-
insertSpaces: true,
38-
path: editorContent?.documentURL.path ?? "",
39-
uri: editorContent?.documentURL.path ?? "",
40-
relativePath: editorContent?.relativePath ?? "",
41-
languageId: editorContent?.language ?? .plaintext,
42-
position: editorContent?.editorContent?.cursorPosition ?? .zero
43-
),
45+
doc: doc,
4446
source: .panel,
4547
workspaceFolder: workspace.projectURL.path
4648
))
@@ -132,11 +134,11 @@ extension GitHubCopilotChatService {
132134
let systemPrompt = history
133135
.filter { $0.role == .system }.compactMap(\.content)
134136
.joined(separator: "\n\n")
135-
137+
136138
if !systemPrompt.isEmpty {
137139
turns.append(.init(request: "[System Prompt]\n\(systemPrompt)", response: "OK!"))
138140
}
139-
141+
140142
for i in firstIndexOfUserMessage..<history.endIndex {
141143
let message = history[i]
142144
let text = message.content ?? ""

0 commit comments

Comments
 (0)