mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:9.0.0012: signature files not detected properly (#19172)
Problem: Signature files not detected properly.
Solution: Add a function to better detect signature files. (Doug Kearns)
cdbfc6dbab
This commit is contained in:
@@ -586,7 +586,6 @@ local extension = {
|
||||
c = function(path, bufnr)
|
||||
return require('vim.filetype.detect').lpc(bufnr)
|
||||
end,
|
||||
sig = 'lprolog',
|
||||
lsl = 'lsl',
|
||||
lss = 'lss',
|
||||
nse = 'lua',
|
||||
@@ -867,6 +866,9 @@ local extension = {
|
||||
end,
|
||||
sieve = 'sieve',
|
||||
siv = 'sieve',
|
||||
sig = function(path, bufnr)
|
||||
return require('vim.filetype.detect').sig(bufnr)
|
||||
end,
|
||||
sil = 'sil',
|
||||
sim = 'simula',
|
||||
['s85'] = 'sinda',
|
||||
|
||||
@@ -922,6 +922,23 @@ function M.rules(path)
|
||||
end
|
||||
end
|
||||
|
||||
-- LambdaProlog and Standard ML signature files
|
||||
function M.sig(bufnr)
|
||||
if vim.g.filetype_sig then
|
||||
return vim.g.filetype_sig
|
||||
end
|
||||
|
||||
local line = nextnonblank(bufnr, 1)
|
||||
|
||||
-- LambdaProlog comment or keyword
|
||||
if findany(line, { '^%s*/%*', '^%s*%%', '^%s*sig%s+%a' }) then
|
||||
return 'lprolog'
|
||||
-- SML comment or keyword
|
||||
elseif findany(line, { '^%s*%(%*', '^%s*signature%s+%a', '^%s*structure%s+%a' }) then
|
||||
return 'sml'
|
||||
end
|
||||
end
|
||||
|
||||
-- This function checks the first 25 lines of file extension "sc" to resolve
|
||||
-- detection between scala and SuperCollider
|
||||
function M.sc(bufnr)
|
||||
|
||||
Reference in New Issue
Block a user