@@ -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
0 commit comments