aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-01-09 17:30:26 +0800
committerGitHub <noreply@github.com>2025-01-09 17:30:26 +0800
commit3f0adf90debb35b5a937480151a659d654106ff6 (patch)
tree831044a1cda13ab6a66456b284c150348ed8b487 /runtime/lua
parentd740a4274d9e1031e05dd86909103dba54fbbaf8 (diff)
downloadrneovim-3f0adf90debb35b5a937480151a659d654106ff6.tar.gz
rneovim-3f0adf90debb35b5a937480151a659d654106ff6.tar.bz2
rneovim-3f0adf90debb35b5a937480151a659d654106ff6.zip
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 https://github.com/vim/vim/commit/4f73c07abff420bad9fa5befc2c284c00b984993 Co-authored-by: Wu, Zhenyu <wuzhenyu@ustc.edu>
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/vim/filetype.lua2
-rw-r--r--runtime/lua/vim/filetype/detect.lua15
2 files changed, 16 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua
index 033a04cdc7..dee1bd88ca 100644
--- a/runtime/lua/vim/filetype.lua
+++ b/runtime/lua/vim/filetype.lua
@@ -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',
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index a1c17bc1af..2d989fdbac 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -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