( prompt: PromptFieldValue, dir: number, placeholder = false )
| 764 | } |
| 765 | |
| 766 | function selectNextToken( |
| 767 | prompt: PromptFieldValue, |
| 768 | dir: number, |
| 769 | placeholder = false |
| 770 | ): PromptFieldValue | null { |
| 771 | let index = prompt.caretPosition.index; |
| 772 | for (let i = index + dir; i >= 0 && i < prompt.segments.length; i += dir) { |
| 773 | let segment = prompt.segments[i]; |
| 774 | if (segment.type === 'token' && (!placeholder || segment.value?.type === 'placeholder')) { |
| 775 | return prompt.withSelectedRange( |
| 776 | new TokenFieldValue.SelectedRange( |
| 777 | {index: i, offset: 0}, |
| 778 | {index: i, offset: segment.text.length} |
| 779 | ) |
| 780 | ); |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | return null; |
| 785 | } |
| 786 | |
| 787 | export interface PromptTokenFieldPopoverProps extends Omit<PopoverProps, 'shouldSkipAnimation'> { |
| 788 | filterAnchor?: Position | null; |
no test coverage detected