Skip to content

Commit 0c8193f

Browse files
committed
Fix that filepath is incorrect
1 parent cba82db commit 0c8193f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

Core/Sources/CopilotService/CopilotService.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,21 @@ public class CopilotBaseService {
7575

7676
return InitializeParams(
7777
processId: Int(ProcessInfo.processInfo.processIdentifier),
78+
clientInfo: .init(name: "Copilot for Xcode"),
7879
locale: nil,
79-
rootPath: nil,
80+
rootPath: projectRoot.path,
8081
rootUri: projectRoot.path,
8182
initializationOptions: nil,
8283
capabilities: capabilities,
8384
trace: nil,
8485
workspaceFolders: nil
8586
)
8687
}
88+
89+
server.notificationHandler = { _, respond in
90+
respond(nil)
91+
}
92+
8793
return server
8894
}()
8995
}

Core/Sources/Service/Environment.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ enum Environment {
7575
)
7676
}
7777
}
78-
if let path {
79-
return URL(fileURLWithPath: path)
78+
if let path = path?.removingPercentEncoding {
79+
let url = URL(fileURLWithPath: path.replacingOccurrences(of: "file://", with: ""))
80+
return url
8081
}
8182
} catch {
8283
if let axError = error as? AXError, axError == .apiDisabled {
@@ -109,7 +110,7 @@ enum Environment {
109110

110111
guard let activeXcode = xcodes.first(where: { $0.isActive }) else { return }
111112
let bundleName = Bundle.main.object(forInfoDictionaryKey: "EXTENSION_BUNDLE_NAME") as! String
112-
113+
113114
/// check if menu is open, if not, click the menu item.
114115
let appleScript = """
115116
tell application "System Events"

0 commit comments

Comments
 (0)