Skip to content

Commit 1305c72

Browse files
committed
Rename SuggestionProvider to CodeSuggestionProvider
1 parent 6d22d48 commit 1305c72

File tree

8 files changed

+20
-19
lines changed

8 files changed

+20
-19
lines changed

Core/Sources/Service/GUI/WidgetDataSource.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import SuggestionWidget
1414
final class WidgetDataSource {}
1515

1616
extension WidgetDataSource: SuggestionWidgetDataSource {
17-
func suggestionForFile(at url: URL) async -> SuggestionProvider? {
17+
func suggestionForFile(at url: URL) async -> CodeSuggestionProvider? {
1818
for workspace in Service.shared.workspacePool.workspaces.values {
1919
if let filespace = workspace.filespaces[url],
2020
let suggestion = filespace.presentingSuggestion

Core/Sources/SuggestionWidget/FeatureReducers/PanelFeature.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public struct PanelFeature: ReducerProtocol {
2323

2424
public enum Action: Equatable {
2525
case presentSuggestion
26-
case presentSuggestionProvider(SuggestionProvider, displayContent: Bool)
26+
case presentSuggestionProvider(CodeSuggestionProvider, displayContent: Bool)
2727
case presentError(String)
2828
case presentPromptToCode(PromptToCodeGroup.PromptToCodeInitialState)
2929
case displayPanelContent
@@ -136,7 +136,7 @@ public struct PanelFeature: ReducerProtocol {
136136
}
137137
}
138138

139-
func fetchSuggestionProvider(fileURL: URL) async -> SuggestionProvider? {
139+
func fetchSuggestionProvider(fileURL: URL) async -> CodeSuggestionProvider? {
140140
guard let provider = await suggestionWidgetControllerDependency
141141
.suggestionWidgetDataSource?
142142
.suggestionForFile(at: fileURL) else { return nil }

Core/Sources/SuggestionWidget/FeatureReducers/SharedPanelFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import SwiftUI
66
public struct SharedPanelFeature: ReducerProtocol {
77
public struct Content: Equatable {
88
public var promptToCodeGroup = PromptToCodeGroup.State()
9-
var suggestion: SuggestionProvider?
9+
var suggestion: CodeSuggestionProvider?
1010
public var promptToCode: PromptToCode.State? { promptToCodeGroup.activePromptToCode }
1111
var error: String?
1212
}

Core/Sources/SuggestionWidget/FeatureReducers/SuggestionPanelFeature.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SwiftUI
44

55
public struct SuggestionPanelFeature: ReducerProtocol {
66
public struct State: Equatable {
7-
var content: SuggestionProvider?
7+
var content: CodeSuggestionProvider?
88
var colorScheme: ColorScheme = .light
99
var alignTopToAnchor = false
1010
var isPanelDisplayed: Bool = false

Core/Sources/SuggestionWidget/Providers/SuggestionProvider.swift renamed to Core/Sources/SuggestionWidget/Providers/CodeSuggestionProvider.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Foundation
22
import SwiftUI
33

4-
public final class SuggestionProvider: ObservableObject, Equatable {
5-
public static func == (lhs: SuggestionProvider, rhs: SuggestionProvider) -> Bool {
4+
public final class CodeSuggestionProvider: ObservableObject, Equatable {
5+
public static func == (lhs: CodeSuggestionProvider, rhs: CodeSuggestionProvider) -> Bool {
66
lhs.code == rhs.code && lhs.language == rhs.language
77
}
88

@@ -12,6 +12,7 @@ public final class SuggestionProvider: ObservableObject, Equatable {
1212
@Published public var suggestionCount: Int = 0
1313
@Published public var currentSuggestionIndex: Int = 0
1414
@Published public var commonPrecedingSpaceCount = 0
15+
@Published public var extraInformation: String = ""
1516

1617
public var onSelectPreviousSuggestionTapped: () -> Void
1718
public var onSelectNextSuggestionTapped: () -> Void

Core/Sources/SuggestionWidget/SuggestionPanelContent/CodeBlockSuggestionPanel.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import SharedUIComponents
22
import SwiftUI
33

44
struct CodeBlockSuggestionPanel: View {
5-
@ObservedObject var suggestion: SuggestionProvider
5+
@ObservedObject var suggestion: CodeSuggestionProvider
66
@Environment(\.colorScheme) var colorScheme
77
@AppStorage(\.suggestionCodeFontSize) var fontSize
88
@AppStorage(\.suggestionDisplayCompactMode) var suggestionDisplayCompactMode
99

1010
struct ToolBar: View {
11-
@ObservedObject var suggestion: SuggestionProvider
11+
@ObservedObject var suggestion: CodeSuggestionProvider
1212

1313
var body: some View {
1414
HStack {
@@ -50,7 +50,7 @@ struct CodeBlockSuggestionPanel: View {
5050
}
5151

5252
struct CompactToolBar: View {
53-
@ObservedObject var suggestion: SuggestionProvider
53+
@ObservedObject var suggestion: CodeSuggestionProvider
5454

5555
var body: some View {
5656
HStack {
@@ -114,7 +114,7 @@ struct CodeBlockSuggestionPanel: View {
114114

115115
struct CodeBlockSuggestionPanel_Dark_Preview: PreviewProvider {
116116
static var previews: some View {
117-
CodeBlockSuggestionPanel(suggestion: SuggestionProvider(
117+
CodeBlockSuggestionPanel(suggestion: CodeSuggestionProvider(
118118
code: """
119119
LazyVGrid(columns: [GridItem(.fixed(30)), GridItem(.flexible())]) {
120120
ForEach(0..<viewModel.suggestion.count, id: \\.self) { index in // lkjaskldjalksjdlkasjdlkajslkdjas
@@ -142,7 +142,7 @@ struct CodeBlockSuggestionPanel_Dark_Preview: PreviewProvider {
142142

143143
struct CodeBlockSuggestionPanel_Bright_Preview: PreviewProvider {
144144
static var previews: some View {
145-
CodeBlockSuggestionPanel(suggestion: SuggestionProvider(
145+
CodeBlockSuggestionPanel(suggestion: CodeSuggestionProvider(
146146
code: """
147147
LazyVGrid(columns: [GridItem(.fixed(30)), GridItem(.flexible())]) {
148148
ForEach(0..<viewModel.suggestion.count, id: \\.self) { index in // lkjaskldjalksjdlkasjdlkajslkdjas
@@ -176,7 +176,7 @@ struct CodeBlockSuggestionPanel_CompactToolBar_Preview: PreviewProvider {
176176
}()
177177

178178
static var previews: some View {
179-
CodeBlockSuggestionPanel(suggestion: SuggestionProvider(
179+
CodeBlockSuggestionPanel(suggestion: CodeSuggestionProvider(
180180
code: """
181181
LazyVGrid(columns: [GridItem(.fixed(30)), GridItem(.flexible())]) {
182182
ForEach(0..<viewModel.suggestion.count, id: \\.self) { index in // lkjaskldjalksjdlkasjdlkajslkdjas
@@ -208,7 +208,7 @@ struct CodeBlockSuggestionPanel_CompactToolBar_Preview: PreviewProvider {
208208

209209
struct CodeBlockSuggestionPanel_Dark_Objc_Preview: PreviewProvider {
210210
static var previews: some View {
211-
CodeBlockSuggestionPanel(suggestion: SuggestionProvider(
211+
CodeBlockSuggestionPanel(suggestion: CodeSuggestionProvider(
212212
code: """
213213
- (void)addSubview:(UIView *)view {
214214
[self addSubview:view];
@@ -233,7 +233,7 @@ struct CodeBlockSuggestionPanel_Dark_Objc_Preview: PreviewProvider {
233233

234234
struct CodeBlockSuggestionPanel_Bright_Objc_Preview: PreviewProvider {
235235
static var previews: some View {
236-
CodeBlockSuggestionPanel(suggestion: SuggestionProvider(
236+
CodeBlockSuggestionPanel(suggestion: CodeSuggestionProvider(
237237
code: """
238238
- (void)addSubview:(UIView *)view {
239239
[self addSubview:view];

Core/Sources/SuggestionWidget/SuggestionWidgetDataSource.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import Foundation
22

33
public protocol SuggestionWidgetDataSource {
4-
func suggestionForFile(at url: URL) async -> SuggestionProvider?
4+
func suggestionForFile(at url: URL) async -> CodeSuggestionProvider?
55
}
66

77
struct MockWidgetDataSource: SuggestionWidgetDataSource {
8-
func suggestionForFile(at url: URL) async -> SuggestionProvider? {
9-
return SuggestionProvider(
8+
func suggestionForFile(at url: URL) async -> CodeSuggestionProvider? {
9+
return CodeSuggestionProvider(
1010
code: """
1111
func test() {
1212
let x = 1

Pro

Submodule Pro updated from c0ffa88 to 7b8199f

0 commit comments

Comments
 (0)