mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-25 19:42:24 +00:00
fix(tui): highlight shell script files (#44772)
This commit is contained in:
parent
162c3fcebd
commit
2f740cec5d
2 changed files with 11 additions and 4 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue