Syntax Highlight Contrast Test
This page is a test fixture for verifying syntax highlighting contrast across all languages used by Ziva.
GDScript
extends CharacterBody2D
class_name Player
# Movement constants
const SPEED: float = 300.0
const JUMP_VELOCITY: float = -400.0
@export var health: int = 100
@onready var sprite: Sprite2D = $Sprite2D
var gravity: float = ProjectSettings.get_setting("physics/2d/default_gravity")
var is_alive: bool = true
"""
Multi-line comment:
This script handles player movement and physics.
"""
func _physics_process(delta: float) -> void:
# Apply gravity
if not is_on_floor():
velocity.y += gravity * delta
# Handle jump
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
var direction := Input.get_axis("ui_left", "ui_right")
if direction != 0:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()
func take_damage(amount: int) -> void:
health -= amount
if health <= 0:
is_alive = false
queue_free()
func _ready() -> void:
print("Player ready with health: ", health)
var items: Array[String] = ["sword", "shield", "potion"]
for item in items:
print(item)Bash
#!/bin/bash
# Install Ziva AI Agent
INSTALL_DIR="$HOME/.local/share/ziva"
VERSION="1.2.3"
# Check prerequisites
if ! command -v godot &> /dev/null; then
echo "Error: Godot not found in PATH"
exit 1
fi
download_release() {
local url="https://github.com/example/ziva/releases/v${VERSION}"
curl -fsSL "$url/ziva-linux-x64.tar.gz" -o /tmp/ziva.tar.gz
tar -xzf /tmp/ziva.tar.gz -C "$INSTALL_DIR"
chmod +x "${INSTALL_DIR}/bin/ziva"
}
# Array and loop
PLATFORMS=("linux" "macos" "windows")
for platform in "${PLATFORMS[@]}"; do
echo "Building for $platform..."
done
[ -d "$INSTALL_DIR" ] || mkdir -p "$INSTALL_DIR"
download_release && echo "Installation complete!"PowerShell
# Ziva Agent installer for Windows
$ErrorActionPreference = "Stop"
$InstallDir = "$env:LOCALAPPDATA\Ziva"
$Version = "1.2.3"
<#
.SYNOPSIS
Downloads and installs the Ziva agent.
.DESCRIPTION
Multi-line comment block describing the installation process.
#>
function Install-Ziva {
param(
[Parameter(Mandatory = $true)]
[string]$TargetDir,
[int]$Retries = 3
)
if (-not (Test-Path $TargetDir)) {
New-Item -ItemType Directory -Path $TargetDir | Out-Null
}
$url = "https://github.com/example/ziva/releases/v$Version/ziva-win-x64.zip"
$tempFile = [System.IO.Path]::GetTempFileName()
try {
Invoke-WebRequest -Uri $url -OutFile $tempFile -UseBasicParsing
Expand-Archive -Path $tempFile -DestinationPath $TargetDir -Force
Write-Host "Installed Ziva v$Version to $TargetDir" -ForegroundColor Green
}
catch {
Write-Error "Installation failed: $_"
}
finally {
Remove-Item $tempFile -ErrorAction SilentlyContinue
}
}
$platforms = @("win-x64", "win-arm64")
foreach ($p in $platforms) {
Write-Output "Platform: $p"
}
Install-Ziva -TargetDir $InstallDirTypeScript
import { z } from "zod";
// Configuration schema with Zod validation
const ConfigSchema = z.object({
apiKey: z.string().min(1),
endpoint: z.string().url(),
maxRetries: z.number().int().positive().default(3),
debug: z.boolean().optional(),
});
type Config = z.infer<typeof ConfigSchema>;
interface AgentResponse<T> {
data: T;
status: "success" | "error";
timestamp: number;
}
/**
* Multi-line JSDoc comment:
* Sends a request to the Ziva agent API.
*/
async function sendRequest<T>(config: Config, payload: Record<string, unknown>): Promise<AgentResponse<T>> {
const url = `${config.endpoint}/v1/agent`;
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${config.apiKey}`,
},
body: JSON.stringify(payload),
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data: T = await response.json();
return {
data,
status: "success",
timestamp: Date.now(),
};
}
// Template literal and arrow function
const formatMessage = (name: string, count: number): string => `Hello ${name}, you have ${count} messages`;
export { sendRequest, formatMessage, ConfigSchema };
export type { Config, AgentResponse };C#
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Ziva.Agent
{
/// <summary>
/// Multi-line XML doc comment:
/// Manages the lifecycle of agent tasks.
/// </summary>
public class TaskManager : IDisposable
{
private readonly List<AgentTask> _tasks = new();
private const int MaxConcurrentTasks = 10;
private bool _disposed = false;
[Obsolete("Use CreateTaskAsync instead")]
public AgentTask CreateTask(string name) => new(name);
public async Task<AgentTask> CreateTaskAsync(
string name,
Priority priority = Priority.Normal)
{
if (string.IsNullOrEmpty(name))
throw new ArgumentNullException(nameof(name));
var task = new AgentTask
{
Id = Guid.NewGuid(),
Name = name,
Priority = priority,
CreatedAt = DateTime.UtcNow
};
_tasks.Add(task);
await Task.Delay(100); // Simulate async work
return task;
}
// Single-line comment: cleanup resources
public void Dispose()
{
if (!_disposed)
{
_tasks.Clear();
_disposed = true;
}
GC.SuppressFinalize(this);
}
}
public enum Priority
{
Low = 0,
Normal = 1,
High = 2,
Critical = 3
}
public record AgentTask
{
public Guid Id { get; init; }
public string Name { get; init; } = "";
public Priority Priority { get; init; }
public DateTime CreatedAt { get; init; }
}
}JSON
{
"name": "ziva-agent",
"version": "1.2.3",
"description": "AI Agent for Godot Engine",
"config": {
"endpoint": "https://api.ziva.sh",
"maxRetries": 3,
"timeout": 30000,
"debug": false,
"features": ["autocomplete", "refactor", "explain"],
"limits": {
"requestsPerMinute": 60,
"tokensPerRequest": null
}
},
"supported_versions": [4.0, 4.1, 4.2, 4.3, 4.4]
}SyntaxHighlightedCommand Component
These use the custom SyntaxHighlightedCommand React component:
Bash Variant
curl -fsSL https://ziva.sh/install.sh | bashPowerShell Variant
irm https://ziva.sh/install.ps1 | iexLast updated on