()
| 145 | } |
| 146 | |
| 147 | private tryReadLineMessage(): string | undefined { |
| 148 | const newline = this.buffer.indexOf('\n'); |
| 149 | if (newline === -1) return undefined; |
| 150 | const line = this.buffer.slice(0, newline).trim(); |
| 151 | this.buffer = this.buffer.slice(newline + 1); |
| 152 | return line.length > 0 ? line : undefined; |
| 153 | } |
| 154 | |
| 155 | private emit(raw: string): void { |
| 156 | // JSON.parse failures propagate to the stdin handler as a -32700 parse error. |