From e1960f0e17b97ceba13e72cf03e15f47b4a62385 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:23:43 -0700 Subject: Drop the highlighter's extension fallback The table of extensions and the second lookup served only a Scintillua with no detect(), which now leaves every file uncoloured but escaped. The fake detect() names a lexer after the file's suffix, so every test lexer is reached through it. --- tests/extensions/fake-lexers/lexer.lua | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'tests/extensions/fake-lexers') diff --git a/tests/extensions/fake-lexers/lexer.lua b/tests/extensions/fake-lexers/lexer.lua index ea7768e..dd7545f 100644 --- a/tests/extensions/fake-lexers/lexer.lua +++ b/tests/extensions/fake-lexers/lexer.lua @@ -1,10 +1,9 @@ -- A miniature stand-in for the Scintillua lexer module, just enough for the -- syntax-highlight checks to drive every path through the filter without the --- real collection installed. load() hands out one of the toy lexers below by --- name and detect() recognises a single filename suffix or a shebang naming --- fake, so a check can tell the detection path apart from the extension path --- by which lexer ends up running. Anything the filter treats as optional, a lexer that will not --- load or one that raises while lexing, has a name here too. +-- real collection installed. detect() names a lexer after the filename's +-- suffix, or fake for a shebang naming it, and load() hands out the toy lexer +-- of that name. Besides fake there is one that stops short and one that +-- raises, and any other name fails to load. local M = {} @@ -69,13 +68,10 @@ function M.load(name) end function M.detect(filename, line) - if filename:match("%.viadetect$") then - return "fake" - end if line ~= nil and line:match("^#!.*fake") then return "fake" end - return nil + return filename:match("%.([^.]+)$") end return M -- cgit