( input: string, cursorPosition: number, )
| 144 | } |
| 145 | |
| 146 | const parseMentionContext = ( |
| 147 | input: string, |
| 148 | cursorPosition: number, |
| 149 | ): TriggerContext => { |
| 150 | if (!input) { |
| 151 | return { active: false, query: '', startIndex: -1 } |
| 152 | } |
| 153 | |
| 154 | const { lineStart, line } = getCurrentLineInfo(input, cursorPosition) |
| 155 | const { active, query, atIndex } = parseAtInLine(line) |
| 156 | |
| 157 | if (!active) { |
| 158 | return { active: false, query: '', startIndex: -1 } |
| 159 | } |
| 160 | |
| 161 | const startIndex = lineStart + atIndex |
| 162 | |
| 163 | return { active: true, query, startIndex } |
| 164 | } |
| 165 | |
| 166 | export type MatchedSlashCommand = Prettify< |
| 167 | SlashCommand & |
no test coverage detected