-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathCodeSuggestion.swift
More file actions
36 lines (32 loc) · 1.07 KB
/
CodeSuggestion.swift
File metadata and controls
36 lines (32 loc) · 1.07 KB
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
28
29
30
31
32
33
34
35
import Foundation
import CodableWrappers
public struct CodeSuggestion: Codable, Equatable {
public init(
id: String,
text: String,
position: CursorPosition,
range: CursorRange
) {
self.text = text
self.position = position
self.id = id
self.range = range
middlewareComments = []
}
public static func == (lhs: CodeSuggestion, rhs: CodeSuggestion) -> Bool {
return lhs.text == rhs.text
&& lhs.position == rhs.position
&& lhs.id == rhs.id
&& lhs.range == rhs.range
}
/// The new code to be inserted and the original code on the first line.
public var text: String
/// The position of the cursor before generating the completion.
public var position: CursorPosition
/// An id.
public var id: String
/// The range of the original code that should be replaced.
public var range: CursorRange
/// A place to store comments inserted by middleware for debugging use.
@FallbackDecoding<EmptyArray> public var middlewareComments: [String]
}