mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 11:58:17 +00:00
vim-patch:9.1.0998: filetype: TI assembly files are not recognized (#31929)
Problem: filetype: TI assembly files are not recognized
Solution: inspect '*.sa' and assembly files and detect TI assembly
files, include filetype plugin and syntax script for TI
assembly files (Wu, Zhenyu)
closes: vim/vim#15827
4f73c07abf
Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
This commit is contained in:
@@ -1064,11 +1064,11 @@ local extension = {
|
||||
builder = 'ruby',
|
||||
rake = 'ruby',
|
||||
rs = 'rust',
|
||||
sa = detect.sa,
|
||||
sage = 'sage',
|
||||
sls = 'salt',
|
||||
sas = 'sas',
|
||||
sass = 'sass',
|
||||
sa = 'sather',
|
||||
sbt = 'sbt',
|
||||
scala = 'scala',
|
||||
ss = 'scheme',
|
||||
|
@@ -34,6 +34,12 @@ local matchregex = vim.filetype._matchregex
|
||||
-- can be detected from the first five lines of the file.
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.asm(path, bufnr)
|
||||
-- tiasm uses `* commment`
|
||||
local lines = table.concat(getlines(bufnr, 1, 10), '\n')
|
||||
if findany(lines, { '^%*', '\n%*', 'Texas Instruments Incorporated' }) then
|
||||
return 'tiasm'
|
||||
end
|
||||
|
||||
local syntax = vim.b[bufnr].asmsyntax
|
||||
if not syntax or syntax == '' then
|
||||
syntax = M.asm_syntax(path, bufnr)
|
||||
@@ -1424,6 +1430,15 @@ function M.sig(_, bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
--- @type vim.filetype.mapfn
|
||||
function M.sa(_, bufnr)
|
||||
local lines = table.concat(getlines(bufnr, 1, 4), '\n')
|
||||
if findany(lines, { '^;', '\n;' }) then
|
||||
return 'tiasm'
|
||||
end
|
||||
return 'sather'
|
||||
end
|
||||
|
||||
-- This function checks the first 25 lines of file extension "sc" to resolve
|
||||
-- detection between scala and SuperCollider
|
||||
--- @type vim.filetype.mapfn
|
||||
|
Reference in New Issue
Block a user