diff --git a/Core/Sources/HostApp/AccountSettings/CodeiumView.swift b/Core/Sources/HostApp/AccountSettings/CodeiumView.swift index 217f8167..e60af2a8 100644 --- a/Core/Sources/HostApp/AccountSettings/CodeiumView.swift +++ b/Core/Sources/HostApp/AccountSettings/CodeiumView.swift @@ -151,7 +151,7 @@ struct CodeiumView: View { Text("Language Server Version: \(version)") uninstallButton } - case let .outdated(current: current, latest: latest): + case let .outdated(current: current, latest: latest, _): HStack { Text("Language Server Version: \(current) (Update Available: \(latest))") uninstallButton @@ -323,7 +323,7 @@ struct CodeiumView_Previews: PreviewProvider { CodeiumView(viewModel: TestViewModel( isSignedIn: true, - installationStatus: .outdated(current: "1.2.9", latest: "1.3.0"), + installationStatus: .outdated(current: "1.2.9", latest: "1.3.0", mandatory: true), installationStep: .downloading )) diff --git a/Tool/Sources/ChatTab/ChatTab.swift b/Tool/Sources/ChatTab/ChatTab.swift index 3ca118af..8d1807cc 100644 --- a/Tool/Sources/ChatTab/ChatTab.swift +++ b/Tool/Sources/ChatTab/ChatTab.swift @@ -67,10 +67,11 @@ open class BaseChatTab { public init(store: StoreOf) { chatTabStore = store - self.id = store.id - self.title = store.title - + Task { @MainActor in + self.id = store.id + self.title = store.title + storeObserver.observe { [weak self] in guard let self else { return } self.title = store.title diff --git a/Tool/Sources/CodeiumService/LanguageServer/CodeiumInstallationManager.swift b/Tool/Sources/CodeiumService/LanguageServer/CodeiumInstallationManager.swift index 7f2c8866..87e5a6ef 100644 --- a/Tool/Sources/CodeiumService/LanguageServer/CodeiumInstallationManager.swift +++ b/Tool/Sources/CodeiumService/LanguageServer/CodeiumInstallationManager.swift @@ -3,7 +3,8 @@ import Terminal public struct CodeiumInstallationManager { private static var isInstalling = false - static let latestSupportedVersion = "1.8.83" + static let latestSupportedVersion = "1.20.9" + static let minimumSupportedVersion = "1.20.0" public init() {} @@ -60,7 +61,7 @@ public struct CodeiumInstallationManager { public enum InstallationStatus { case notInstalled case installed(String) - case outdated(current: String, latest: String) + case outdated(current: String, latest: String, mandatory: Bool) case unsupported(current: String, latest: String) } @@ -87,14 +88,21 @@ public struct CodeiumInstallationManager { { switch version.compare(targetVersion, options: .numeric) { case .orderedAscending: - return .outdated(current: version, latest: targetVersion) + switch version.compare(Self.minimumSupportedVersion) { + case .orderedAscending: + return .outdated(current: version, latest: Self.latestSupportedVersion, mandatory: true) + case .orderedSame: + return .outdated(current: version, latest: Self.latestSupportedVersion, mandatory: false) + case .orderedDescending: + return .outdated(current: version, latest: Self.latestSupportedVersion, mandatory: false) + } case .orderedSame: return .installed(version) case .orderedDescending: return .unsupported(current: version, latest: targetVersion) } } - return .outdated(current: "Unknown", latest: Self.latestSupportedVersion) + return .outdated(current: "Unknown", latest: Self.latestSupportedVersion, mandatory: false) } public enum InstallationStep { diff --git a/Tool/Sources/CodeiumService/LanguageServer/CodeiumModels.swift b/Tool/Sources/CodeiumService/LanguageServer/CodeiumModels.swift index d6af5d25..486e5f45 100644 --- a/Tool/Sources/CodeiumService/LanguageServer/CodeiumModels.swift +++ b/Tool/Sources/CodeiumService/LanguageServer/CodeiumModels.swift @@ -72,9 +72,7 @@ struct CompletionPart: Codable { } struct CodeiumDocument: Codable { - var absolute_path: String - // Path relative to the root of the workspace. - var relative_path: String + var absolute_path_migrate_me_to_uri: String var text: String // Language ID provided by the editor. var editor_language: String diff --git a/Tool/Sources/CodeiumService/Services/CodeiumService.swift b/Tool/Sources/CodeiumService/Services/CodeiumService.swift index 3aa03540..33cb8c0d 100644 --- a/Tool/Sources/CodeiumService/Services/CodeiumService.swift +++ b/Tool/Sources/CodeiumService/Services/CodeiumService.swift @@ -102,7 +102,7 @@ public class CodeiumService { languageServerVersion = version case .notInstalled: throw CodeiumError.languageServerNotInstalled - case let .outdated(version, _): + case let .outdated(version, _, _): languageServerVersion = version throw CodeiumError.languageServerOutdated } @@ -257,14 +257,12 @@ extension CodeiumService: CodeiumSuggestionServiceType { requestCounter += 1 let languageId = languageIdentifierFromFileURL(fileURL) - let relativePath = getRelativePath(of: fileURL) let task = Task { let request = try await CodeiumRequest.GetCompletion(requestBody: .init( metadata: getMetadata(), document: .init( - absolute_path: fileURL.path, - relative_path: relativePath, + absolute_path_migrate_me_to_uri: fileURL.path, text: content, editor_language: languageId.rawValue, language: .init(codeLanguage: languageId), @@ -278,8 +276,7 @@ extension CodeiumService: CodeiumSuggestionServiceType { .map { openedDocument in let languageId = languageIdentifierFromFileURL(openedDocument.url) return .init( - absolute_path: openedDocument.url.path, - relative_path: openedDocument.relativePath, + absolute_path_migrate_me_to_uri: openedDocument.url.path, text: openedDocument.content, editor_language: languageId.rawValue, language: .init(codeLanguage: languageId) @@ -417,11 +414,9 @@ extension CodeiumService: CodeiumSuggestionServiceType { workspaceURL: URL ) async throws { let languageId = languageIdentifierFromFileURL(fileURL) - let relativePath = getRelativePath(of: fileURL) let request = await CodeiumRequest.RefreshContextForIdeAction(requestBody: .init( active_document: .init( - absolute_path: fileURL.path, - relative_path: relativePath, + absolute_path_migrate_me_to_uri: fileURL.path, text: content, editor_language: languageId.rawValue, language: .init(codeLanguage: languageId), diff --git a/Tool/Sources/SuggestionProvider/SuggestionServiceMiddleware.swift b/Tool/Sources/SuggestionProvider/SuggestionServiceMiddleware.swift index f26492c1..7d08aeaa 100644 --- a/Tool/Sources/SuggestionProvider/SuggestionServiceMiddleware.swift +++ b/Tool/Sources/SuggestionProvider/SuggestionServiceMiddleware.swift @@ -45,6 +45,13 @@ public enum SuggestionServiceMiddlewareContainer { public struct DisabledLanguageSuggestionServiceMiddleware: SuggestionServiceMiddleware { public init() {} + + struct DisabledLanguageError: Error, LocalizedError { + let language: String + var errorDescription: String? { + "Suggestion service is disabled for \(language)." + } + } public func getSuggestion( _ request: SuggestionRequest, @@ -55,10 +62,7 @@ public struct DisabledLanguageSuggestionServiceMiddleware: SuggestionServiceMidd if UserDefaults.shared.value(for: \.suggestionFeatureDisabledLanguageList) .contains(where: { $0 == language.rawValue }) { - #if DEBUG - Logger.service.info("Suggestion service is disabled for \(language).") - #endif - return [] + throw DisabledLanguageError(language: language.rawValue) } return try await next(request) diff --git a/Tool/Sources/XcodeInspector/XcodeInspector+TriggerCommand.swift b/Tool/Sources/XcodeInspector/XcodeInspector+TriggerCommand.swift index e6ea06eb..e06e5575 100644 --- a/Tool/Sources/XcodeInspector/XcodeInspector+TriggerCommand.swift +++ b/Tool/Sources/XcodeInspector/XcodeInspector+TriggerCommand.swift @@ -104,6 +104,7 @@ public extension AppInstanceInspector { .joined(separator: " of ") return """ click menu item "\(button)" of \(list) \ + of menu 1 \ of menu bar item "\(menuBarItem)" \ of menu bar 1 """ diff --git a/Version.xcconfig b/Version.xcconfig index 32d3ed1c..4b72dd9e 100644 --- a/Version.xcconfig +++ b/Version.xcconfig @@ -1,3 +1,3 @@ -APP_VERSION = 0.34.1 -APP_BUILD = 413 +APP_VERSION = 0.34.2 +APP_BUILD = 415