Highlights /command at the start of input in yellow.
| 36 | |
| 37 | |
| 38 | class _SlashCommandLexer(Lexer): |
| 39 | """Highlights /command at the start of input in yellow.""" |
| 40 | |
| 41 | def lex_document(self, document): |
| 42 | def get_line(lineno): |
| 43 | line = document.lines[lineno] |
| 44 | if line.startswith("/"): |
| 45 | parts = line.split(" ", 1) |
| 46 | tokens = [("class:slash-cmd", parts[0])] |
| 47 | if len(parts) > 1: |
| 48 | tokens.append(("", " " + parts[1])) |
| 49 | return tokens |
| 50 | return [("", line)] |
| 51 | |
| 52 | return get_line |
| 53 | |
| 54 | |
| 55 | def _serialize_tool_calls(tool_calls) -> list[dict]: |