Skip to content

Commit c45d4cd

Browse files
committed
Refactor the @ sign tooltip logic to only show on hover when no context is available, and standardize diff length check in commit handling
1 parent d093952 commit c45d4cd

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

‎packages/ui/src/components/editor/panel/ChatInput/ChatInput.tsx‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,6 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
244244
document.removeEventListener('selectionchange', on_selection_change)
245245
}, [props.on_caret_position_change, props.value, props.context_file_paths])
246246

247-
useEffect(() => {
248-
if (show_at_sign_tooltip) {
249-
const timer = setTimeout(() => {
250-
set_show_at_sign_tooltip(false)
251-
}, 2000)
252-
return () => clearTimeout(timer)
253-
}
254-
}, [show_at_sign_tooltip])
255-
256247
const placeholder = useMemo(() => {
257248
const active_history = props.chat_history
258249

@@ -493,10 +484,13 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
493484
}}
494485
>
495486
<button
496-
onClick={() => {
487+
onMouseEnter={() => {
497488
if (has_no_context) {
498489
set_show_at_sign_tooltip(true)
499-
} else {
490+
}
491+
}}
492+
onClick={() => {
493+
if (!has_no_context) {
500494
props.on_at_sign_click()
501495
}
502496
}}

‎packages/vscode/src/views/panel/backend/message-handlers/handle-commit-changes/handle-commit-changes.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function proceed_with_commit_generation(
2626
cwd: repository.rootUri.fsPath
2727
}).toString()
2828

29-
if (!diff || diff.length === 0) {
29+
if (!diff || diff.length == 0) {
3030
vscode.window.showInformationMessage(
3131
dictionary.information_message.NO_CHANGES_TO_COMMIT
3232
)

0 commit comments

Comments
 (0)