Skip to content

Commit f13b82d

Browse files
committed
Drop GitHub Copilot language server to 1.44.0
1 parent 2c394e3 commit f13b82d

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

Core/Sources/HostApp/AccountSettings/GitHubCopilotView.swift

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct GitHubCopilotView: View {
158158
"node"
159159
)
160160
) {
161-
Text("Path to Node (v18+)")
161+
Text("Path to Node (v20.8+)")
162162
}
163163

164164
Text(
@@ -261,21 +261,20 @@ struct GitHubCopilotView: View {
261261
if isRunningAction {
262262
ActivityIndicatorView()
263263
}
264-
}
264+
}
265265
.opacity(isRunningAction ? 0.8 : 1)
266266
.disabled(isRunningAction)
267267

268268
Button("Refresh configurations") {
269269
refreshConfiguration()
270270
}
271271

272-
// Not available yet
273-
// Form {
274-
// GitHubCopilotModelPicker(
275-
// title: "Chat Model Name",
276-
// gitHubCopilotModelId: $settings.gitHubCopilotModelId
277-
// )
278-
// }
272+
Form {
273+
GitHubCopilotModelPicker(
274+
title: "Chat Model Name",
275+
gitHubCopilotModelId: $settings.gitHubCopilotModelId
276+
)
277+
}
279278
}
280279

281280
SettingsDivider("Advanced")

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 = "87038123804796ca7af20d1b71c3428d858a9124"
9+
let commitHash = "a9228e015528c9307890c48083c925eb98a64a79"
1010
let link = "https://github.com/github/copilot.vim/archive/\(commitHash).zip"
1111
return URL(string: link)!
1212
}
1313

14-
static let latestSupportedVersion = "1.48.0"
14+
static let latestSupportedVersion = "1.44.0"
1515
static let minimumSupportedVersion = "1.32.0"
1616

1717
public init() {}

Tool/Sources/GitHubCopilotService/LanguageServer/GitHubCopilotService.swift

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import AppKit
22
import enum CopilotForXcodeKit.SuggestionServiceError
33
import Foundation
4+
import JSONRPC
45
import LanguageClient
56
import LanguageServerProtocol
67
import Logger
@@ -133,6 +134,9 @@ public class GitHubCopilotBaseService {
133134
let urls = try GitHubCopilotBaseService.createFoldersIfNeeded()
134135
let executionParams: Process.ExecutionParameters
135136
let runner = UserDefaults.shared.value(for: \.runNodeWith)
137+
let watchedFiles = JSONValue(
138+
booleanLiteral: projectRootURL.path == "/" ? false : true
139+
)
136140

137141
guard let agentJSURL = { () -> URL? in
138142
let languageServerDotJS = urls.executableURL
@@ -148,7 +152,7 @@ public class GitHubCopilotBaseService {
148152
}() else {
149153
throw GitHubCopilotError.languageServerNotInstalled
150154
}
151-
155+
152156
let indexJSURL: URL = try {
153157
if UserDefaults.shared.value(for: \.gitHubCopilotLoadKeyChainCertificates) {
154158
let url = urls.executableURL
@@ -244,6 +248,8 @@ public class GitHubCopilotBaseService {
244248
experimental: nil
245249
)
246250

251+
let pretendToBeVSCode = UserDefaults.shared
252+
.value(for: \.gitHubCopilotPretendIDEToBeVSCode)
247253
return InitializeParams(
248254
processId: Int(ProcessInfo.processInfo.processIdentifier),
249255
clientInfo: .init(
@@ -254,7 +260,24 @@ public class GitHubCopilotBaseService {
254260
locale: nil,
255261
rootPath: projectRootURL.path,
256262
rootUri: projectRootURL.path,
257-
initializationOptions: nil,
263+
initializationOptions: [
264+
"editorInfo": pretendToBeVSCode ? .hash([
265+
"name": "vscode",
266+
"version": "1.99.3",
267+
]) : .hash([
268+
"name": "Xcode",
269+
"version": .string(xcodeVersion() ?? "16.0"),
270+
]),
271+
"editorPluginInfo": .hash([
272+
"name": "Copilot for Xcode",
273+
"version": .string(Bundle.main
274+
.infoDictionary?["CFBundleShortVersionString"] as? String ?? ""),
275+
]),
276+
"copilotCapabilities": [
277+
/// The editor has support for watching files over LSP
278+
"watchedFiles": watchedFiles,
279+
]
280+
],
258281
capabilities: capabilities,
259282
trace: .off,
260283
workspaceFolders: [WorkspaceFolder(
@@ -632,7 +655,7 @@ extension InitializingServer: GitHubCopilotLSP {
632655
}
633656
}
634657

635-
private func xcodeVersion() async -> String? {
658+
private func xcodeVersion() -> String? {
636659
let process = Process()
637660
process.executableURL = URL(fileURLWithPath: "/usr/bin/xcrun")
638661
process.arguments = ["xcodebuild", "-version"]

0 commit comments

Comments
 (0)