mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.1539: typst filetype is not recognized (#23578)
Problem: Typst filetype is not recognized.
Solution: Distinguish between sql and typst. (Gaetan Lepage, closes vim/vim#12363)
4ce1bda869
This commit is contained in:
@@ -997,7 +997,9 @@ local extension = {
|
||||
spi = 'spyce',
|
||||
spy = 'spyce',
|
||||
tyc = 'sql',
|
||||
typ = 'sql',
|
||||
typ = function(path, bufnr)
|
||||
return require('vim.filetype.detect').typ(bufnr)
|
||||
end,
|
||||
pkb = 'sql',
|
||||
tyb = 'sql',
|
||||
pks = 'sql',
|
||||
|
||||
@@ -1322,6 +1322,28 @@ function M.txt(bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
function M.typ(bufnr)
|
||||
if vim.g.filetype_typ then
|
||||
return vim.g.filetype_typ
|
||||
end
|
||||
|
||||
for _, line in ipairs(getlines(bufnr, 1, 200)) do
|
||||
if
|
||||
findany(line, {
|
||||
'^CASE[%s]?=[%s]?SAME$',
|
||||
'^CASE[%s]?=[%s]?LOWER$',
|
||||
'^CASE[%s]?=[%s]?UPPER$',
|
||||
'^CASE[%s]?=[%s]?OPPOSITE$',
|
||||
'^TYPE%s',
|
||||
})
|
||||
then
|
||||
return 'sql'
|
||||
end
|
||||
end
|
||||
|
||||
return 'typst'
|
||||
end
|
||||
|
||||
-- Determine if a .v file is Verilog, V, or Coq
|
||||
function M.v(bufnr)
|
||||
if vim.fn.did_filetype() ~= 0 then
|
||||
|
||||
Reference in New Issue
Block a user