forked from github/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatTabFactory.swift
More file actions
27 lines (25 loc) · 800 Bytes
/
ChatTabFactory.swift
File metadata and controls
27 lines (25 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import ConversationTab
import ChatService
import ChatTab
import Foundation
import PromptToCodeService
import SuggestionBasic
import SuggestionWidget
import XcodeInspector
enum ChatTabFactory {
static func chatTabBuilderCollection() -> [ChatTabBuilderCollection] {
func folderIfNeeded(
_ builders: [any ChatTabBuilder],
title: String
) -> ChatTabBuilderCollection? {
if builders.count > 1 {
return .folder(title: title, kinds: builders.map(ChatTabKind.init))
}
if let first = builders.first { return .kind(ChatTabKind(first)) }
return nil
}
return [
folderIfNeeded(ConversationTab.chatBuilders(), title: ConversationTab.name),
].compactMap { $0 }
}
}