In the agents window when looking at the files to review, the syntax highlighting breaks after a some lines and just show the lines without highlighting. Not sure if it’s specific to PHP files or just with any files.
Steps to Reproduce
Make the agent do big changes across multiple files
Click on review changes
The syntax highlighting stops on every file after a while or right from the start of the file sometimes
Expected Behavior
All of the files should keep their highlighted syntax
Using PHP devsense extension of the syntax highlighting in the IDE and it works fine in the agents window when looking at the file directly not in review mode.
There is a known issue where syntax highlighting stops working when a diff in the Agents Window contains a file whose original or modified text exceeds 200,000 characters, or whose modified line numbers extend beyond line 1,500. Does that match what you’re experiencing?
No actually it stops working halfway even on small files, the number of lines doesn’t seem to impact it. For example I got the issue on a file with 150 lines.
Here’s the file anonymized if you want to reproduce it on your side:
<?php
namespace Example\Import;
use Example\Validators\RegionCode;
use Example\Validators\PriorityLevel;
use Example\Validators\ProcessingMode;
use Example\Validators\ContentTag;
use Example\Validators\OwnerAlias;
final class ImportFilterCriteria
{
/**
* @param list<string> $tags
*/
private function __construct(
public readonly ?int $regionCode = null,
public readonly ?int $priorityLevel = null,
public readonly array $tags = [],
public readonly ?string $processingMode = null,
public readonly ?string $ownerAlias = null,
) {
}
public function isBlank(): bool
{
return $this->regionCode === null
&& $this->priorityLevel === null
&& $this->tags === []
&& $this->processingMode === null
&& $this->ownerAlias === null;
}
/**
* @param array<string, mixed>|object|null $snapshot
*/
public static function fromRequestSnapshot(array|object|null $snapshot): self
{
if ($snapshot === null) {
return new self();
}
$raw = (array) $snapshot;
$regionCode = self::coerceInteger($raw['region_code'] ?? $raw['regionCode'] ?? null);
if ($regionCode !== null && !RegionCode::isAllowed($regionCode)) {
$regionCode = null;
}
$priorityLevel = self::coerceInteger($raw['priority_level'] ?? $raw['priorityLevel'] ?? null);
if ($priorityLevel !== null && !PriorityLevel::isAllowed($priorityLevel)) {
$priorityLevel = null;
}
$processingMode = self::coerceText($raw['processing_mode'] ?? $raw['processingMode'] ?? null);
if ($processingMode !== null && !ProcessingMode::isAllowed($processingMode)) {
$processingMode = null;
}
$ownerAlias = self::coerceText(
$raw['owner_alias'] ?? $raw['ownerAlias'] ?? $raw['alias'] ?? null
);
if ($ownerAlias !== null && !OwnerAlias::isAllowed($ownerAlias)) {
$ownerAlias = null;
}
return new self(
$regionCode,
$priorityLevel,
self::collectTags($raw['tags'] ?? null),
$processingMode,
$ownerAlias,
);
}
/**
* @param array<string, mixed> $exportRow
* @return array<string, mixed>
*/
public function applyToExportRow(array $exportRow): array
{
if ($this->regionCode !== null) {
$exportRow['region'] = $this->regionCode;
}
if ($this->priorityLevel !== null) {
$exportRow['priority'] = $this->priorityLevel;
}
if ($this->tags !== []) {
$exportRow['tags'] = $this->tags;
}
if ($this->processingMode !== null) {
$exportRow['processing_mode'] = $this->processingMode;
}
if ($this->ownerAlias !== null) {
$exportRow['owner_alias'] = $this->ownerAlias;
}
return $exportRow;
}
/**
* @return list<string>
*/
private static function collectTags(mixed $tags): array
{
if (!is_array($tags)) {
return [];
}
$accepted = [];
foreach ($tags as $tag) {
if (is_string($tag) && ContentTag::isAllowed($tag)) {
$accepted[] = $tag;
}
}
return $accepted;
}
private static function coerceInteger(mixed $input): ?int
{
if ($input === null || $input === '') {
return null;
}
if (is_int($input)) {
return $input;
}
if (is_string($input) && is_numeric($input)) {
return (int) $input;
}
return null;
}
private static function coerceText(mixed $input): ?string
{
if (!is_string($input) || $input === '') {
return null;
}
return $input;
}
}
We use DEVSENSE PHP extension for the linting in VSCode although I’m not sure it’s relevant in the Agents Window.
This happens specifically in the Changes tab of the Glass window. Another interesting detail I’ve noted is that the highlighting doesn’t always break in the same spot. Sometimes it’s further down in the file and I can make it change places by switching from the other tabs like Files or Terminal and back to the Changes. Very odd.