( prompt: PromptFieldValue, dir: number, placeholder = false )
| 818 | } |
| 819 | |
| 820 | function selectNextToken( |
| 821 | prompt: PromptFieldValue, |
| 822 | dir: number, |
| 823 | placeholder = false |
| 824 | ): PromptFieldValue | null { |
| 825 | let index = prompt.caretPosition.index; |
| 826 | for (let i = index + dir; i >= 0 && i < prompt.segments.length; i += dir) { |
| 827 | let segment = prompt.segments[i]; |
| 828 | if (segment.type === 'token' && (!placeholder || segment.value?.type === 'placeholder')) { |
| 829 | return prompt.withSelectedRange( |
| 830 | new TokenFieldValue.SelectedRange( |
| 831 | {index: i, offset: 0}, |
| 832 | {index: i, offset: segment.text.length} |
| 833 | ) |
| 834 | ); |
| 835 | } |
| 836 | } |
| 837 | |
| 838 | return null; |
| 839 | } |
| 840 | |
| 841 | export interface PromptTokenFieldPopoverProps extends Omit<PopoverProps, 'shouldSkipAnimation'> { |
| 842 | filterAnchor?: Position | null; |
no test coverage detected