( input: string, cursorPosition?: number, )
| 31 | } |
| 32 | |
| 33 | const getCurrentLineInfo = ( |
| 34 | input: string, |
| 35 | cursorPosition?: number, |
| 36 | ): LineInfo => { |
| 37 | const upto = cursorPosition ?? input.length |
| 38 | const textUpTo = input.slice(0, upto) |
| 39 | const lastNewline = textUpTo.lastIndexOf('\n') |
| 40 | const lineStart = lastNewline === -1 ? 0 : lastNewline + 1 |
| 41 | const line = textUpTo.slice(lineStart) |
| 42 | return { lineStart, line } |
| 43 | } |
| 44 | |
| 45 | const parseSlashContext = (input: string): TriggerContext => { |
| 46 | if (!input) { |
no outgoing calls
no test coverage detected