diff options
author | Christian Clason <c.clason@uni-graz.at> | 2022-06-29 18:43:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-29 18:43:56 +0200 |
commit | 1eb9624666a8478d66e693c7f00fc633a6b1b8ca (patch) | |
tree | d0ff784074aab6781b5d702ace1eabbcc5c74140 /runtime/lua/vim | |
parent | ba583f820655d3d7cf4c85854c0359c54d49ae5a (diff) | |
download | rneovim-1eb9624666a8478d66e693c7f00fc633a6b1b8ca.tar.gz rneovim-1eb9624666a8478d66e693c7f00fc633a6b1b8ca.tar.bz2 rneovim-1eb9624666a8478d66e693c7f00fc633a6b1b8ca.zip |
vim-patch:9.0.0006: not all Visual Basic files are recognized (#19153)
Problem: Not all Visual Basic files are recognized.
Solution: Change detection of *.cls files. (Doug Kearns)
https://github.com/vim/vim/commit/8b5901e2f9466eb6f38f5b251e871f609f65e252
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index ddef27a0f0..342f947524 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -83,19 +83,19 @@ function M.bas(bufnr) local fb_keywords = [[\c^\s*\%(extern\|var\|enum\|private\|scope\|union\|byref\|operator\|constructor\|delete\|namespace\|public\|property\|with\|destructor\|using\)\>\%(\s*[:=(]\)\@!]] local fb_preproc = - [[\c^\s*\%(#\a\+\|option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\)]] + [[\c^\s*\%(#\s*\a\+\|option\s\+\%(byval\|dynamic\|escape\|\%(no\)\=gosub\|nokeyword\|private\|static\)\>\|\%(''\|rem\)\s*\$lang\>\|def\%(byte\|longint\|short\|ubyte\|uint\|ulongint\|ushort\)\>\)]] local fb_comment = "^%s*/'" -- OPTION EXPLICIT, without the leading underscore, is common to many dialects local qb64_preproc = [[\c^\s*\%($\a\+\|option\s\+\%(_explicit\|_\=explicitarray\)\>\)]] for _, line in ipairs(getlines(bufnr, 1, 100)) do - if line:find(fb_comment) or matchregex(line, fb_preproc) or matchregex(line, fb_keywords) then + if findany(line:lower(), visual_basic_content) then + return 'vb' + elseif line:find(fb_comment) or matchregex(line, fb_preproc) or matchregex(line, fb_keywords) then return 'freebasic' elseif matchregex(line, qb64_preproc) then return 'qb64' - elseif findany(line:lower(), visual_basic_content) then - return 'vb' end end return 'basic' @@ -172,11 +172,16 @@ function M.class(bufnr) end function M.cls(bufnr) + if vim.g.filetype_cls then + return vim.g.filetype_cls + end local line = getlines(bufnr, 1) if line:find('^%%') then return 'tex' elseif line:find('^#') and line:lower():find('rexx') then return 'rexx' + elseif line == 'VERSION 1.0 CLASS' then + return 'vb' else return 'st' end |