Skip to content

Commit dc0b117

Browse files
committed
If there is no selection, automatically detach
1 parent c591718 commit dc0b117

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Core/Sources/SuggestionWidget/FeatureReducers/PromptToCode.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ public struct PromptToCode: ReducerProtocol {
105105
self.generateDescriptionRequirement = generateDescriptionRequirement
106106
self.isAttachedToSelectionRange = isAttachedToSelectionRange
107107
self.commandName = commandName
108+
109+
if selectionRange?.isEmpty ?? true {
110+
self.isAttachedToSelectionRange = false
111+
}
108112
}
109113
}
110114

Core/Sources/SuggestionWidget/SuggestionPanelContent/PromptToCodePanel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extension PromptToCodePanel {
7878
}
7979
}.foregroundColor(.primary)
8080
} else {
81-
Text("text selection").foregroundColor(.secondary)
81+
Text("current selection").foregroundColor(.secondary)
8282
}
8383
}
8484
.padding(2)

0 commit comments

Comments
 (0)