Skip to content

Commit 3581873

Browse files
committed
Update
1 parent 37645ef commit 3581873

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

Core/Sources/Service/SuggestionCommandHandler/WindowBaseCommandHandler.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ extension WindowBaseCommandHandler {
388388
character: max(last.end.character, range.end.character)
389389
)
390390
)
391-
} else if !range.isEmpty {
391+
} else {
392392
all.append(range)
393393
}
394394
}

Core/Sources/SuggestionWidget/SuggestionPanelContent/PromptToCodePanelView.swift

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ extension PromptToCodePanelView {
187187
&& !isCodeEmpty
188188
&& !isDescriptionEmpty
189189
}
190-
let isAttached = store.promptToCodeState.isAttachedToTarget
191190
if !isResponding || isRespondingButCodeIsReady {
192191
HStack {
193192
Menu {
@@ -422,6 +421,7 @@ extension PromptToCodePanelView {
422421
let language = store.promptToCodeState.source.language
423422
let isAttached = store.promptToCodeState.isAttachedToTarget
424423
let lastId = store.promptToCodeState.snippets.last?.id
424+
let isGenerating = store.promptToCodeState.isGenerating
425425
ForEach(store.scope(
426426
state: \.snippetPanels,
427427
action: \.snippetPanel
@@ -436,7 +436,8 @@ extension PromptToCodePanelView {
436436
language: language,
437437
codeForegroundColor: codeForegroundColor ?? .primary,
438438
codeBackgroundColor: codeBackgroundColor,
439-
isAttached: isAttached
439+
isAttached: isAttached,
440+
isGenerating: isGenerating
440441
)
441442
}
442443
}
@@ -455,6 +456,7 @@ extension PromptToCodePanelView {
455456
let codeForegroundColor: Color
456457
let codeBackgroundColor: Color
457458
let isAttached: Bool
459+
let isGenerating: Bool
458460

459461
var body: some View {
460462
WithPerceptionTracking {
@@ -463,7 +465,8 @@ extension PromptToCodePanelView {
463465
DescriptionContent(store: store, codeForegroundColor: codeForegroundColor)
464466
CodeContent(
465467
store: store,
466-
language: language,
468+
language: language,
469+
isGenerating: isGenerating,
467470
codeForegroundColor: codeForegroundColor
468471
)
469472
SnippetTitleBar(
@@ -562,6 +565,7 @@ extension PromptToCodePanelView {
562565
struct CodeContent: View {
563566
let store: StoreOf<PromptToCodeSnippetPanel>
564567
let language: CodeLanguage
568+
let isGenerating: Bool
565569
let codeForegroundColor: Color?
566570

567571
@AppStorage(\.wrapCodeInPromptToCode) var wrapCode
@@ -595,11 +599,19 @@ extension PromptToCodePanelView {
595599
}
596600
}
597601
} else {
598-
Text("Thinking...")
599-
.foregroundStyle(.secondary)
600-
.padding(.horizontal, 8)
601-
.padding(.vertical, 4)
602-
.scaleEffect(x: 1, y: -1, anchor: .center)
602+
if isGenerating {
603+
Text("Thinking...")
604+
.foregroundStyle(.secondary)
605+
.padding(.horizontal, 8)
606+
.padding(.vertical, 4)
607+
.scaleEffect(x: 1, y: -1, anchor: .center)
608+
} else {
609+
Text("Enter your requirements to generate code.")
610+
.foregroundStyle(.secondary)
611+
.padding(.horizontal, 8)
612+
.padding(.vertical, 4)
613+
.scaleEffect(x: 1, y: -1, anchor: .center)
614+
}
603615
}
604616
}
605617
}

0 commit comments

Comments
 (0)