forked from intitni/CopilotForXcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSuggestionServiceEventHandler.swift
More file actions
28 lines (21 loc) · 984 Bytes
/
Copy pathSuggestionServiceEventHandler.swift
File metadata and controls
28 lines (21 loc) · 984 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 CopilotForXcodeKit
import Foundation
import SuggestionBasic
public protocol SuggestionServiceEventHandler {
func didAccept(_ suggestion: SuggestionBasic.CodeSuggestion, workspaceInfo: WorkspaceInfo)
func didReject(_ suggestions: [SuggestionBasic.CodeSuggestion], workspaceInfo: WorkspaceInfo)
func didDismiss(_ 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)
}
}