Completions bug fixes

This commit is contained in:
2026-01-10 07:56:40 +00:00
parent e9da17eb34
commit b2a64f219f
21 changed files with 400 additions and 193 deletions

View File

@@ -1,10 +1,10 @@
#!/usr/bin/env fish
# Fish highlighting torture test 🐟
# Fish highlighting torture test
# === Variables ===
set normal_var "hello"
set normal_var hello
set -l local_var 123
set -gx GLOBAL_VAR "world"
set -gx GLOBAL_VAR world
set PATH $PATH /usr/local/bin
set --erase OLD_VAR
@@ -17,15 +17,15 @@ set double "double quoted $normal_var"
set escaped "newline\n tab\t dollar\$"
# === Conditionals ===
if test $normal_var = "hello"
echo "equal"
else if test $normal_var != "world"
if test $normal_var = hello
echo equal
else if test $normal_var != world
echo "not equal"
end
# === Logical operators ===
true and echo "yes"
false or echo "fallback"
true and echo yes
false or echo fallback
not false
# === Arithmetic ===
@@ -50,14 +50,14 @@ function greet --argument name
echo "Hello $name"
end
greet "world"
greet world
# === Command substitution ===
set files (ls | grep ".fish")
# === Redirections ===
echo "output" > /tmp/fish_test.txt
cat < /tmp/fish_test.txt >> /tmp/fish_log.txt
echo output >/tmp/fish_test.txt
cat </tmp/fish_test.txt >>/tmp/fish_log.txt
# === Process substitution ===
diff (ls /bin) (ls /usr/bin)
@@ -65,11 +65,11 @@ diff (ls /bin) (ls /usr/bin)
# === Case statement ===
switch $argv[1]
case start
echo "Starting"
echo Starting
case stop
echo "Stopping"
echo Stopping
case '*'
echo "Unknown"
echo Unknown
end
# === Subshell ===
@@ -79,10 +79,10 @@ end
# === Comments & operators ===
# && || | & ! should all highlight
true && echo "ok" || echo "fail"
true && echo ok || echo fail
# === Regex ===
string match -r '^[a-z]+$' "hello"
string match -r '^[a-z]+$' hello
# === Test builtin ===
test -f /etc/passwd
@@ -90,3 +90,4 @@ test ! -d /does/not/exist
# === Exit ===
exit 0

View File

@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PHP Syntax Stress Test</title>
@@ -33,98 +34,103 @@
<body>
<?php
// Basic variables
$number = 42;
$text = "Hello PHP";
$truth = true;
$nothing = null;
<?php
// Basic variables
$number = 42;
$text = "Hello PHP";
$truth = true;
$nothing = null;
// Constants
define("APP_NAME", "SyntaxTester");
// Constants
define("APP_NAME", "SyntaxTester");
// Arrays
$list = [1, 2, 3];
$assoc = [
"one" => 1,
"two" => 2
];
// Arrays
$list = [1, 2, 3];
$assoc = [
"one" => 1,
"two" => 2
];
// Function
function add(int $a, int $b): int {
return $a + $b;
}
// Class + methods
class User {
private string $name;
public static int $count = 0;
public function __construct(string $name) {
$this->name = $name;
self::$count++;
// Function
function add(int $a, int $b): int
{
return $a + $b;
}
public function greet(): string {
return "Hello {$this->name}";
// Class + methods
class User
{
private string $name;
public static int $count = 0;
public function __construct(string $name)
{
$this->name = $name;
self::$count++;
}
public function greet(): string
{
return "Hello {$this->name}";
}
}
}
// Object usage
$user = new User("Alice");
echo $user->greet();
// Object usage
$user = new User("Alice");
echo $user->greet();
// Control flow
if ($number > 10) {
echo "Big number";
} elseif ($number === 10) {
echo "Exactly ten";
} else {
echo "Small number";
}
// Control flow
if ($number > 10) {
echo "Big number";
} elseif ($number === 10) {
echo "Exactly ten";
} else {
echo "Small number";
}
// Loop
foreach ($list as $item) {
echo $item;
}
// Loop
foreach ($list as $item) {
echo $item;
}
// Match expression
$result = match ($number) {
1 => "one",
2 => "two",
default => "many"
};
// Match expression
$result = match ($number) {
1 => "one",
2 => "two",
default => "many"
};
// Try / catch
try {
throw new Exception("Test exception");
} catch (Exception $e) {
echo $e->getMessage();
}
// Try / catch
try {
throw new Exception("Test exception");
} catch (Exception $e) {
echo $e->getMessage();
}
// Anonymous function
$double = fn($x) => $x * 2;
// Anonymous function
$double = fn($x) => $x * 2;
// Nullsafe operator
$len = $user?->name ? strlen($user->name) : 0;
// Nullsafe operator
$len = $user?->name ? strlen($user->name) : 0;
// Ternary
$status = $truth ? "yes" : "no";
// Ternary
$status = $truth ? "yes" : "no";
// Include / require
require_once "config.php";
// Include / require
require_once "config.php";
// Output
echo "<div class='box'>";
echo htmlspecialchars($text);
echo "</div>";
?>
// Output
echo "<div class='box'>";
echo htmlspecialchars($text);
echo "</div>";
?>
<script>
// JS interacting with PHP output
const phpValue = <?= json_encode($number) ?>;
console.log("Value from PHP:", phpValue);
</script>
<script>
// JS interacting with PHP output
const phpValue = <?= json_encode($number) ?>;
console.log("Value from PHP:", phpValue);
</script>
</body>
</html>

View File

@@ -1,3 +1,4 @@
from __future__ import annotations
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Test file for Python Tree-sitter highlighting."""
@@ -17,7 +18,6 @@ __name__ # builtin constant
import os
import sys as system
from re import compile as re_compile
from __future__ import annotations
from math import *
# ==============================
@@ -94,7 +94,7 @@ while x > 0:
try:
1 / 0
except ZeroDivisionError as e:
except ZeroDivisionError as err:
raise
finally:
pass
@@ -105,7 +105,7 @@ finally:
a, b = 5, 10
c = a + b * 2 // 3 % 4 ** 2
d = (a << 2) & b | c ^ ~a
e = not a or b and c
ef = not a or b and c
# ==============================
# f-strings / interpolation
@@ -131,7 +131,7 @@ def static_func():
def cls_func(cls):
return cls
@custom_decorator
# @custom_decorator
def decorated_func():
return None