11import AppKit
2+ import enum CopilotForXcodeKit. SuggestionServiceError
23import Foundation
34import LanguageClient
45import LanguageServerProtocol
@@ -95,7 +96,7 @@ public class GitHubCopilotBaseService {
9596 let projectRootURL : URL
9697 var server : GitHubCopilotLSP
9798 var localProcessServer : CopilotLocalProcessServer ?
98-
99+
99100 deinit {
100101 localProcessServer? . terminate ( )
101102 }
@@ -111,7 +112,7 @@ public class GitHubCopilotBaseService {
111112 let urls = try GitHubCopilotBaseService . createFoldersIfNeeded ( )
112113 let executionParams : Process . ExecutionParameters
113114 let runner = UserDefaults . shared. value ( for: \. runNodeWith)
114-
115+
115116 guard let agentJSURL = {
116117 let languageServerDotJS = urls. executableURL
117118 . appendingPathComponent ( " copilot/dist/language-server.js " )
@@ -129,7 +130,8 @@ public class GitHubCopilotBaseService {
129130
130131 let indexJSURL : URL = try {
131132 if UserDefaults . shared. value ( for: \. gitHubCopilotLoadKeyChainCertificates) {
132- let url = urls. executableURL. appendingPathComponent ( " load-self-signed-cert-1.34.0.js " )
133+ let url = urls. executableURL
134+ . appendingPathComponent ( " load-self-signed-cert-1.34.0.js " )
133135 if !FileManager. default. fileExists ( atPath: url. path) {
134136 let file = Bundle . module. url (
135137 forResource: " load-self-signed-cert-1.34.0 " ,
@@ -409,8 +411,9 @@ public final class GitHubCopilotService: GitHubCopilotBaseService,
409411 return completions
410412 } catch let error as ServerError {
411413 switch error {
412- case . serverError( 1000 , _, _) :
413- throw GitHubCopilotError . languageServerError ( error)
414+ case . serverError( 1000 , _, _) : // not logged-in error
415+ throw SuggestionServiceError
416+ . notice ( GitHubCopilotError . languageServerError ( error) )
414417 case . serverError:
415418 // sometimes the content inside language server is not new enough, which can
416419 // lead to an version mismatch error. We can try a few times until the content
@@ -429,7 +432,7 @@ public final class GitHubCopilotService: GitHubCopilotBaseService,
429432 throw error
430433 }
431434 }
432-
435+
433436 func recoverContent( ) async {
434437 try ? await notifyChangeTextDocument (
435438 fileURL: fileURL,
0 commit comments