diff options
Diffstat (limited to 'runtime/lua/vim/filetype')
| -rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 1cc81b177f..98b001bd51 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -869,6 +869,16 @@ function M.log(path, _) end --- @type vim.filetype.mapfn +function M.ll(_, bufnr) + local first_line = getline(bufnr, 1) + if matchregex(first_line, [[;\|\<source_filename\>\|\<target\>]]) then + return 'llvm' + else + return 'lifelines' + end +end + +--- @type vim.filetype.mapfn function M.lpc(_, bufnr) if vim.g.lpc_syntax_for_c then for _, line in ipairs(getlines(bufnr, 1, 12)) do @@ -1908,7 +1918,7 @@ local function match_from_hashbang(contents, path, dispatch_extension) end for k, v in pairs(patterns_hashbang) do - local ft = type(v) == 'table' and v[1] or v + local ft = type(v) == 'table' and v[1] or v --[[@as string]] local opts = type(v) == 'table' and v[2] or {} if opts.vim_regex and matchregex(name, k) or name:find(k) then return ft @@ -2080,6 +2090,7 @@ local function match_from_text(contents, path) return ft end else + --- @cast k string local opts = type(v) == 'table' and v[2] or {} if opts.start_lnum and opts.end_lnum then assert( |