The best way to control Claude Code, Codex and more from any computer or phone
fix(web,mobile): Luau files are syntax highlighted in diffs (#25865)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>
Yuruzuu committed
Oct 31, 2026 at 10:16 UTC
80a2351fcb909034e65a512dfabeb3cdfd367762
4 files changed
+39
-2
apps/mobile/src/lib/highlightLanguage.test.ts
new
+13
@@ -0,0 +1,13 @@
1
+import { describe, expect, it } from "vite-plus/test";
2
+
3
+import { resolveHighlightLanguage } from "./highlightLanguage";
4
+
5
+describe("resolveHighlightLanguage", () => {
6
+ it.each([
7
+ ["src/init.luau", "lua"],
8
+ ["styles/page.xsl", "xml"],
9
+ ["styles/page.xslt", "xml"],
10
+ ])("%s highlights as %s", (path, language) => {
11
+ expect(resolveHighlightLanguage({ path })).toBe(language);
12
+ });
13
+});
apps/mobile/src/lib/highlightLanguage.ts
+9
-1
@@ -1,8 +1,16 @@
1
import "@t3tools/client-runtime/assembly-highlighting";
2
-import { getFiletypeFromFileName } from "@pierre/diffs/utils/getFiletypeFromFileName";
2
+import {
3
+ getFiletypeFromFileName,
4
+ setCustomExtension,
5
+} from "@pierre/diffs/utils/getFiletypeFromFileName";
6
7
import { HIGHLIGHTS_LANGUAGE_IDS } from "./highlights.generated";
8
9
+// Highlights has no lexer for these dialects, so they use their base language's.
10
+setCustomExtension("luau", "lua");
11
+setCustomExtension("xsl", "xml");
12
+setCustomExtension("xslt", "xml");
13
+
14
/** The native lexer ID for a @pierre/highlights language name, or 0 (plain text). */
15
export function highlightLanguageId(language: string): number {
16
return Object.hasOwn(HIGHLIGHTS_LANGUAGE_IDS, language) ? HIGHLIGHTS_LANGUAGE_IDS[language]! : 0;
apps/web/src/lib/syntaxHighlighting.test.ts
+11
-1
@@ -1,9 +1,19 @@
1
import { getFiletypeFromFileName } from "@pierre/diffs";
2
-import { expect, it } from "vite-plus/test";
2
+import { describe, expect, it } from "vite-plus/test";
3
4
import { getSyntaxHighlighterPromise } from "./syntaxHighlighting";
5
import { DIFF_THEME_NAMES } from "./diffRendering";
6
7
+describe("dialect file types", () => {
8
+ it.each([
9
+ ["src/init.luau", "lua"],
10
+ ["styles/page.xsl", "xml"],
11
+ ["styles/page.xslt", "xml"],
12
+ ])("%s highlights as %s", (path, language) => {
13
+ expect(getFiletypeFromFileName(path)).toBe(language);
14
+ });
15
+});
16
+
17
it.each([
18
"asm",
19
"assembly",
apps/web/src/lib/syntaxHighlighting.ts
+6
@@ -1,6 +1,7 @@
1
import "@t3tools/client-runtime/assembly-highlighting";
2
import {
3
getSharedHighlighter,
4
+ setCustomExtension,
5
type DiffsHighlighter,
6
type HighlighterTypes,
7
type SupportedLanguages,
@@ -8,6 +9,11 @@ import {
9
10
import { DIFF_THEME_NAMES } from "./diffRendering";
11
12
+// Highlights has no lexer for these dialects, so they use their base language's.
13
+setCustomExtension("luau", "lua");
14
+setCustomExtension("xsl", "xml");
15
+setCustomExtension("xslt", "xml");
16
+
17
/**
18
* Highlights' hand-written WASM lexers tokenize large files 10-40x faster than
19
* Shiki and never backtrack like Shiki's JS regex engine. Only one highlighter