Skip to content

Commit e895b34

Browse files
committed
Align at sign trigger condition with hash and slash triggers
- in prompt field, ignore '@' when typed right after another character ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ ├── backend │ │ └── message-handlers │ │ └── handle-at-sign-quick-pick.ts │ └── frontend │ └── Main │ ├── Main.tsx │ └── MainView │ └── MainView.tsx └── packages └── ui └── src └── components └── editor └── common └── prompts └── PromptField ├── PromptField.tsx ├── components │ └── Footer │ └── Footer.tsx └── hooks └── use-handlers ├── handle-input-change.ts ├── types.ts └── use-handlers.ts
1 parent e52d803 commit e895b34

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎packages/ui/src/components/editor/common/prompts/PromptField/hooks/use-handlers/handle-input-change.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ export const create_handle_input_change =
2828
}
2929

3030
if (char_before_caret == '@') {
31-
let should_trigger = true
31+
const is_at_start = caret_position == 1
32+
let is_after_whitespace = false
3233
if (caret_position > 1) {
3334
const char_before_at = new_display_value.charAt(caret_position - 2)
34-
if (char_before_at == '@') {
35-
should_trigger = false
36-
}
35+
is_after_whitespace = /\s/.test(char_before_at)
3736
}
3837

39-
if (should_trigger) {
38+
if (is_at_start || is_after_whitespace) {
4039
props.on_at_sign_click()
4140
}
4241
} else if (char_before_caret == '#') {

0 commit comments

Comments
 (0)