fix(tui): highlight shell script files (#44772)

This commit is contained in:
Kit Langton 2026-08-24 17:21:19 -04:00 committed by GitHub
parent 162c3fcebd
commit 2f740cec5d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 4 deletions

View file

@ -89,10 +89,10 @@ export const LANGUAGE_EXTENSIONS: Record<string, string> = {
".sass": "sass",
".scala": "scala",
".shader": "shaderlab",
".sh": "shellscript",
".bash": "shellscript",
".zsh": "shellscript",
".ksh": "shellscript",
".sh": "bash",
".bash": "bash",
".zsh": "bash",
".ksh": "bash",
".sql": "sql",
".svelte": "svelte",
".swift": "swift",

View file

@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test"
import parsers from "../../src/parsers-config"
import { filetype } from "../../src/util/filetype"
describe("util.filetype", () => {
@ -9,6 +10,12 @@ describe("util.filetype", () => {
expect(filetype("README.unknown")).toBeUndefined()
})
test("maps shell filenames to the registered bash parser", () => {
const languages = ["script.sh", "script.bash", "script.zsh", "script.ksh"].map(filetype)
expect(languages).toEqual(["bash", "bash", "bash", "bash"])
expect(parsers.parsers.some((parser) => languages.every((language) => language === parser.filetype))).toBe(true)
})
test("uses none for missing filenames", () => {
expect(filetype()).toBe("none")
expect(filetype("")).toBe("none")