ai/ai-chat/ai-chat-code-block.component.ts

Description

Shows code, or the input and output of an AI tool call, in a read-only block with syntax highlighting. The block is always dark, in the light theme too, so that all code in the chat looks the same. It colors JSON itself, and other code with the tokens Monaco finds, without creating an editor, so it is cheap for many calls and does not change the theme of the editors on the page.

Example

Metadata

Relationships

<!-- Kept on one line: every character between the tags of a pre element is shown -->
<!-- prettier-ignore -->
<pre class="ai-code-block m-b-0 small text-pre-wrap text-break-word" [attr.data-label]="label()" [attr.tabindex]="isScrollable() ? 0 : null" [attr.role]="isScrollable() ? 'region' : null" [attr.aria-label]="isScrollable() ? label() : null" #pre><code>@for (line of lines(); track $index; let last = $last) {@for (token of line; track $index) {<span [class]="'ai-code-block__' + token.kind">{{ token.text }}</span>}@if (!last) {&#10;}}</code></pre>

results matching ""

    No results matching ""