Skip to content

Commit

Permalink
Merge branch 'release/0.28.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
intitni committed Dec 12, 2023
2 parents 8613f35 + 447cb12 commit cee3f35
Show file tree
Hide file tree
Showing 20 changed files with 251 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/close_inactive_issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
exempt-issue-labels: "low priority, help wanted, planned"
exempt-issue-labels: "low priority, help wanted, planned, investigating, blocked"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
Expand Down
17 changes: 14 additions & 3 deletions Core/Sources/ChatGPTChatTab/Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,26 @@ public struct DisplayedChatMessage: Equatable {
}

public struct Reference: Equatable {
public typealias Kind = ChatMessage.Reference.Kind

public var title: String
public var subtitle: String
public var uri: String
public var startLine: Int?

public init(title: String, subtitle: String, uri: String, startLine: Int?) {
public var kind: Kind

public init(
title: String,
subtitle: String,
uri: String,
startLine: Int?,
kind: Kind
) {
self.title = title
self.subtitle = subtitle
self.uri = uri
self.startLine = startLine
self.kind = kind
}
}

Expand Down Expand Up @@ -304,7 +314,8 @@ struct Chat: ReducerProtocol {
title: $0.title,
subtitle: $0.subTitle,
uri: $0.uri,
startLine: $0.startLine
startLine: $0.startLine,
kind: $0.kind
)
}
)
Expand Down
3 changes: 2 additions & 1 deletion Core/Sources/ChatGPTChatTab/ChatPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ struct ChatPanel_Preview: PreviewProvider {
title: "Hello Hello Hello Hello",
subtitle: "Hi Hi Hi Hi",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .class
),
]
),
Expand Down
107 changes: 97 additions & 10 deletions Core/Sources/ChatGPTChatTab/Views/BotMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,20 @@ struct ReferenceList: View {
chat.send(.referenceClicked(reference))
}) {
HStack(spacing: 8) {
ReferenceIcon(kind: reference.kind)
.layoutPriority(2)
Text(reference.title)
.truncationMode(.middle)
.lineLimit(1)
.layoutPriority(1)
Text(reference.subtitle)
.lineLimit(1)
.truncationMode(.middle)
.layoutPriority(/*@START_MENU_TOKEN@*/0/*@END_MENU_TOKEN@*/)
.foregroundStyle(.tertiary)
.layoutPriority(0)
}
.padding(.vertical, 6)
.padding(.horizontal, 8)
.padding(.vertical, 4)
.padding(.horizontal, 4)
.frame(maxWidth: .infinity, alignment: .leading)
.overlay {
RoundedRectangle(cornerRadius: 4)
Expand All @@ -134,6 +137,83 @@ struct ReferenceList: View {
}
}

struct ReferenceIcon: View {
let kind: DisplayedChatMessage.Reference.Kind

var body: some View {
RoundedRectangle(cornerRadius: 4)
.fill({
switch kind {
case .class:
Color.purple
case .struct:
Color.purple
case .enum:
Color.purple
case .actor:
Color.purple
case .protocol:
Color.purple
case .extension:
Color.indigo
case .case:
Color.green
case .property:
Color.teal
case .typealias:
Color.orange
case .function:
Color.teal
case .method:
Color.blue
case .text:
Color.gray
case .webpage:
Color.blue
case .other:
Color.gray
}
}())
.frame(width: 22, height: 22)
.overlay(alignment: .center) {
Group {
switch kind {
case .class:
Text("C")
case .struct:
Text("S")
case .enum:
Text("E")
case .actor:
Text("A")
case .protocol:
Text("Pr")
case .extension:
Text("Ex")
case .case:
Text("K")
case .property:
Text("P")
case .typealias:
Text("T")
case .function:
Text("𝑓")
case .method:
Text("M")
case .text:
Text("Tx")
case .webpage:
Text("Wb")
case .other:
Text("Ot")
}
}
.font(.system(size: 12).monospaced())
.foregroundColor(.white)
}
}
}

#Preview("Bot Message") {
BotMessage(
id: "1",
Expand All @@ -147,7 +227,8 @@ struct ReferenceList: View {
title: "ReferenceList",
subtitle: "/Core/Sources/ChatGPTChatTab/Views/BotMessage.swift:100",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .class
), count: 20),
chat: .init(initialState: .init(), reducer: Chat(service: .init()))
)
Expand All @@ -161,37 +242,43 @@ struct ReferenceList: View {
title: "ReferenceList",
subtitle: "/Core/Sources/ChatGPTChatTab/Views/BotMessage.swift:100",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .class
),
.init(
title: "BotMessage.swift:100-102",
subtitle: "/Core/Sources/ChatGPTChatTab/Views",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .struct
),
.init(
title: "ReferenceList",
subtitle: "/Core/Sources/ChatGPTChatTab/Views/BotMessage.swift:100",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .function
),
.init(
title: "ReferenceList",
subtitle: "/Core/Sources/ChatGPTChatTab/Views/BotMessage.swift:100",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .case
),
.init(
title: "ReferenceList",
subtitle: "/Core/Sources/ChatGPTChatTab/Views/BotMessage.swift:100",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .extension
),
.init(
title: "ReferenceList",
subtitle: "/Core/Sources/ChatGPTChatTab/Views/BotMessage.swift:100",
uri: "https://google.com",
startLine: nil
startLine: nil,
kind: .webpage
),
], chat: .init(initialState: .init(), reducer: Chat(service: .init())))
}
Expand Down
15 changes: 10 additions & 5 deletions Core/Sources/HostApp/DebugView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ final class DebugSettings: ObservableObject {
@AppStorage(\.useUserDefaultsBaseAPIKeychain) var useUserDefaultsBaseAPIKeychain
@AppStorage(\.disableEnhancedWorkspace) var disableEnhancedWorkspace
@AppStorage(\.disableGitIgnoreCheck) var disableGitIgnoreCheck
@AppStorage(\.disableFileContentManipulationByCheatsheet)
var disableFileContentManipulationByCheatsheet
init() {}
}

Expand Down Expand Up @@ -60,19 +62,23 @@ struct DebugSettingsView: View {
Toggle(isOn: $settings.useUserDefaultsBaseAPIKeychain) {
Text("Store API keys in UserDefaults")
}

Toggle(isOn: $settings.disableEnhancedWorkspace) {
Text("Disable enhanced workspace")
}

Toggle(isOn: $settings.disableGitIgnoreCheck) {
Text("Disable git ignore check")
}


Toggle(isOn: $settings.disableFileContentManipulationByCheatsheet) {
Text("Disable file content manipulation by cheatsheet")
}

Button("Reset migration version to 0") {
UserDefaults.shared.set(nil, forKey: "OldMigrationVersion")
}

Button("Reset 0.23.0 migration") {
UserDefaults.shared.set("239", forKey: "OldMigrationVersion")
UserDefaults.shared.set(nil, forKey: "MigrateTo240Finished")
Expand All @@ -92,4 +98,3 @@ struct DebugSettingsView_Preview: PreviewProvider {
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ public struct PanelFeature: ReducerProtocol {

case .removeDisplayedContent:
state.content.error = nil
state.content.promptToCodeGroup.activeDocumentURL = nil
state.content.suggestion = nil
return .none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public struct PromptToCodeGroup: ReducerProtocol {
return promptToCodes[id: id]
}
set {
activeDocumentURL = newValue?.id
if let id = newValue?.id {
promptToCodes[id: id] = newValue
}
Expand Down
Loading

0 comments on commit cee3f35

Please sign in to comment.