fix(web): language dialects use their base language's icon#22455

merged6
main
GitHub fork: fix/dialect-language-icons
opened10d agobyYYuruzuu
View on GitHubTwo-way sync enabledPR last imported 19h ago

Problem

A language with no logo of its own gets the blank file icon, even when it's a dialect of a language that has one. Luau is an example: a ```luau code block shows the blank icon in its header and in the composer's language picker, and so does a .luau file in the file browser and diff tree. Lua next to it gets the Lua logo.

Change

Icons resolve by extension through T3_PIERRE_ICONS in apps/web/src/pierre-icons.ts, and fence languages go through the same table (luau becomes file.luau). T3 adds icons for languages Pierre lacks, such as Lua and XML. Their dialects had no entries, so they fell through to Pierre's default.

DIALECT_BASE_EXTENSIONS lets a dialect reuse its base language's icon. Each dialect is listed against a base extension, and the base's icon is looked up from the same table. The satisfies keeps a typo or a base with no icon from compiling. Covering another dialect takes one line. Current entries:

  • luau uses lua
  • xsd, xsl, xslt use xml

Pierre's built-in set already covers its own dialects (jsonc, zsh, mts, scss), so this only fills gaps in T3's custom icons. Because the change lives in T3_PIERRE_ICONS, code block headers, the composer picker, the file browser, and the diff tree all pick it up. Mobile doesn't use these icons.

Scope and approval

This qualifies for the small, focused bug-fix exception in CONTRIBUTING.md. It fills in missing icon mappings without adding a feature, changing product defaults, or touching contracts.

Verification

  • vp test run src/pierre-icons.test.ts: 25/25 pass. The new cases check that luau and xsl files and fences resolve to the same icon as lua and xml.
  • vp lint on both files and tsc-rs --noEmit for apps/web are clean.
  • Checked by hand in the web dev client (headless Chromium, dark theme), with a ```luau block in the composer:
Before (main)After (this branch)
before: luau block shows the blank file iconafter: luau block shows the Lua icon

Made with Claude Opus 5.5 via Claude Code in T3 Code.

🤖 Generated with Claude Code

Checks

23 successful · 13 skipped
All checks passed
c1c72ef

Added 1 commit

  • fix(web): Luau code blocks and files show the Lua iconbee4695
Synced from GitHub

Approvability

Verdict: Approved at bee4695

Macroscope's review found this PR approvable — This is a focused web UI bug fix that adds Lua/XML icon fallbacks for dialect file extensions and code fences, with representative test coverage. It preserves existing mappings and does not change product defaults or introduce broader runtime capabilities.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

  • Last reviewed commit: c1c72ef4c0c851c7b093ff8d5468136d9fa5c4e3

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The icon map now maps .luau files to the Lua icon and .xsd, .xsl, and .xslt files to the XML icon. Tests cover regular and synthetic filenames.

Changes: Language icon mappings

Layer / File(s)Summary
Extension mappings and alias coverage
apps/web/src/pierre-icons.ts, apps/web/src/pierre-icons.test.ts
The icon map adds mappings for Luau and XML-related extensions. Tests check lowercase and uppercase paths, filename recognition, and synthetic filenames derived from language IDs.

Priority: External image Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#25865: Adds dialect-to-base mappings for syntax highlighting; its registries are separate from the file icon mappings.

Suggested labels: size:M

Suggested reviewers: juliusmarminge

Merge Risk: External image Minimal · up to c1c72

The narrowly scoped icon mappings are covered and introduce no identified merge-blocking risk.

Architecture risk: External image Low · up to 4f52d

The change affects 1 system.

Changed systems: apps/web

Architecture concerns No architecture-level concerns identified.

Review details

Systems and components

  • observed — apps/web (ui) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in apps/web/src/pierre-icons.ts: Added LANGUAGE_ICONS_BY_EXTENSION for language and format extensions, plus DIALECT_BASE_EXTENSIONS mapping luau to Lua and XML dialects to XML icons.
  • observed — Modified behavior in apps/web/src/pierre-icons.ts: Replaced the inline language-extension entries with the shared icon map and generated dialect entries from their base extensions.
  • observed — Modified behavior in apps/web/src/pierre-icons.test.ts: Added the syntheticFileNameForLanguageId import alongside the existing Pierre icon resolver exports.
  • observed — Modified behavior in apps/web/src/pierre-icons.test.ts: Added parameterized coverage confirming Luau and XSL entries resolve to their respective base-language icons for both extension-based and synthetic language-ID filenames.
Pre-merge checks: Passed 4
Check nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main change: dialect languages now use their base language's icon.
Description checkPassedThe description includes Problem, Change, Scope and approval, and Verification sections. It explains the affected behavior, implementation, scope rationale, test results, manual checks, and unverified…
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes Problem, Change, Scope and approval, and Verification sections. It explains the affected behavior, implementation, scope rationale, test results, manual checks, and unverified environments.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Added 4 commits

  • Merge remote-tracking branch 'upstream/main' into fix/dialect-language-icons4f52d8e
  • Merge remote-tracking branch 'upstream/main' into fix/dialect-language-iconsc597be4
  • Merge remote-tracking branch 'github/main' into takeover/224550932ee0
  • fix(web): simplify dialect icon aliases and cover every mapping93300d5

Note

Written by gpt-6.1-sol on behalf of Maria

thanks @Yuruzuu. your shared icon-table fix correctly covers file trees, diffs, code-block headers, and the composer picker.

updated this pr in place, preserving your commits and merging current main. simplified the implementation to four explicit aliases in the existing table: luau uses lua; xsd, xsl, and xslt use xml. removed only the extracted language table and generated dialect entries. all original mappings remain. the final diff against main is 23 added lines in two files.

verification passed: all four regression cases failed with main's generic icon, then all 24 tests passed with the fix. blacksmith vp run check:changed passed formatting, lint, both knip checks, affected typechecks, and tests. real chrome composer checks passed for all four dialects plus lua, xml, and typescript. two independent code reviews found no issues at 93300d55c12b493ea9f0d2b13cc7e93430242cd9.

unverified: native desktop/mobile clients and separate file-tree/diff UI interactions. those web consumers use the same icon configuration. github reports the head mergeable, but CI run 40395242393 is "awaiting approval from a maintainer in #22455" (action_required), so full ci has not run. the latest bot review is pending.

before, main's icon table:

luau composer before: generic file icon

after:

luau composer after: lua icon

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified as-is at 93300d55c12b493ea9f0d2b13cc7e93430242cd9 on this linux boat vm. no code changes or pushes were needed.

  • reproduced on github/main (f120c51134) in a separate worktree after vp i. luau/xsd/xsl/xslt files had generic icons; dialect reply headers fell back to text; the luau composer and picker had generic icons.
  • stopped main's captured dev-server process before starting the exact pr head, installed its dependencies, and ran its real dev server with separate empty state.
  • used repo playwright and /usr/bin/google-chrome. created local git projects and threads through the app on both revisions. real codex gpt-6.1-sol turns created seven files and returned seven code blocks. no mocks, fixtures, replay, or demo data.
  • on the pr, luau uses the lua icon and xsd/xsl/xslt use xml in the real reply headers, composer blocks and picker, changed-files list, file browser, and diff tree. checked rendered icon references as well as screenshots.
  • nearby behavior passed: lua/xml/typescript retain their icons; changing the composer language preserves the code; opening a real file and selecting its diff work. inspected light and dark themes.
  • blacksmith vp run check:changed passed format, lint, both knip checks, affected typechecks, and all 24 existing icon tests. the worker needed the pr's base/history fetched before the check could run.

before, with matching sample filenames and luau composer content:

main: generic dialect icons in the picker, composer and file trees

after:

pr: lua and xml dialect icons in the picker, composer, reply and file trees

recording: language selection preserves code, real file opening and diff navigation

Not verified

native electron, ios/android, macos/windows, other providers, and remote/relay/tunnel connections were not exercised. this change is in web icon configuration; mobile does not consume it.

full github ci and preview builds remain unverified: ci run 40395242393 reports action_required pending maintainer approval. the remote changed-file checks above passed independently. uploaded video playback and seeking were checked in chrome; t3's in-app media player was not exercised. reopened this comment: git.cafe renders external media as links, so the uploaded images and video were opened and checked directly.

Added 1 commit