-
-
Notifications
You must be signed in to change notification settings - Fork 426
Expand file tree
/
Copy pathSuggestionServiceEventHandler.swift
More file actions
27 lines (20 loc) · 885 Bytes
/
SuggestionServiceEventHandler.swift
File metadata and controls
27 lines (20 loc) · 885 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
import CopilotForXcodeKit
import Foundation
import SuggestionBasic
public protocol SuggestionServiceEventHandler {
func didAccept(_ suggestion: SuggestionBasic.CodeSuggestion, workspaceInfo: WorkspaceInfo)
func didReject(_ suggestions: [SuggestionBasic.CodeSuggestion], workspaceInfo: WorkspaceInfo)
}
public enum SuggestionServiceEventHandlerContainer {
static var builtinHandlers: [SuggestionServiceEventHandler] = []
static var customHandlers: [SuggestionServiceEventHandler] = []
public static var handlers: [SuggestionServiceEventHandler] {
builtinHandlers + customHandlers
}
public static func addHandler(_ handler: SuggestionServiceEventHandler) {
customHandlers.append(handler)
}
public static func addHandlers(_ handlers: [SuggestionServiceEventHandler]) {
customHandlers.append(contentsOf: handlers)
}
}