Skip to content

Commit 6b58a40

Browse files
committed
Bump Copilot.vim to 1.37.0
1 parent 2a44f1f commit 6b58a40

4 files changed

Lines changed: 21 additions & 9 deletions

File tree

Tool/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ let package = Package(
323323
.product(name: "LanguageServerProtocol", package: "LanguageServerProtocol"),
324324
.product(name: "CopilotForXcodeKit", package: "CopilotForXcodeKit"),
325325
],
326-
resources: [.copy("Resources/load-self-signed-cert.js")]
326+
resources: [.copy("Resources/load-self-signed-cert-1.34.0.js")]
327327
),
328328
.testTarget(
329329
name: "GitHubCopilotServiceTests",

Tool/Sources/GitHubCopilotService/LanguageServer/GitHubCopilotInstallationManager.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ public struct GitHubCopilotInstallationManager {
66
public private(set) static var isInstalling = false
77

88
static var downloadURL: URL {
9-
let commitHash = "c79d711cbf7c6672c6c57d6df7c5ab7b6cac2b7a"
9+
let commitHash = "0668308e68b0ac28b332b204b469fbe04601536a"
1010
let link = "https://github.com/github/copilot.vim/archive/\(commitHash).zip"
1111
return URL(string: link)!
1212
}
1313

14-
static let latestSupportedVersion = "1.33.0"
14+
static let latestSupportedVersion = "1.37.0"
1515
static let minimumSupportedVersion = "1.32.0"
1616

1717
public init() {}

Tool/Sources/GitHubCopilotService/LanguageServer/GitHubCopilotService.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,28 @@ public class GitHubCopilotBaseService {
111111
let urls = try GitHubCopilotBaseService.createFoldersIfNeeded()
112112
let executionParams: Process.ExecutionParameters
113113
let runner = UserDefaults.shared.value(for: \.runNodeWith)
114-
115-
let agentJSURL = urls.executableURL.appendingPathComponent("copilot/dist/agent.js")
116-
guard FileManager.default.fileExists(atPath: agentJSURL.path) else {
114+
115+
guard let agentJSURL = {
116+
let languageServerDotJS = urls.executableURL
117+
.appendingPathComponent("copilot/dist/language-server.js")
118+
if FileManager.default.fileExists(atPath: languageServerDotJS.path) {
119+
return languageServerDotJS
120+
}
121+
let agentsDotJS = urls.executableURL.appendingPathComponent("copilot/dist/agent.js")
122+
if FileManager.default.fileExists(atPath: agentsDotJS.path) {
123+
return agentsDotJS
124+
}
125+
return nil
126+
}() else {
117127
throw GitHubCopilotError.languageServerNotInstalled
118128
}
119129

120130
let indexJSURL: URL = try {
121131
if UserDefaults.shared.value(for: \.gitHubCopilotLoadKeyChainCertificates) {
122-
let url = urls.executableURL.appendingPathComponent("load-self-signed-cert.js")
132+
let url = urls.executableURL.appendingPathComponent("load-self-signed-cert-1.34.0.js")
123133
if !FileManager.default.fileExists(atPath: url.path) {
124134
let file = Bundle.module.url(
125-
forResource: "load-self-signed-cert",
135+
forResource: "load-self-signed-cert-1.34.0",
126136
withExtension: "js"
127137
)!
128138
do {
@@ -399,6 +409,8 @@ public final class GitHubCopilotService: GitHubCopilotBaseService,
399409
return completions
400410
} catch let error as ServerError {
401411
switch error {
412+
case .serverError(1000, _, _):
413+
throw GitHubCopilotError.languageServerError(error)
402414
case .serverError:
403415
// sometimes the content inside language server is not new enough, which can
404416
// lead to an version mismatch error. We can try a few times until the content

Tool/Sources/GitHubCopilotService/Resources/load-self-signed-cert.js renamed to Tool/Sources/GitHubCopilotService/Resources/load-self-signed-cert-1.34.0.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ function duplicated(cert, index, arr) {
3737

3838
initialize();
3939

40-
require("./copilot/dist/agent.js");
40+
require("./copilot/dist/language-server.js");

0 commit comments

Comments
 (0)