diff options
author | Gregory Anders <8965202+gpanders@users.noreply.github.com> | 2022-07-27 10:06:09 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-27 10:06:09 -0600 |
commit | 9b447c7ce5bd81d576bcc9253ed77416d9baf59b (patch) | |
tree | 5f4f294794fa2ab0d9917eb594a722d7a8cdb6f3 | |
parent | f57432af4db184912af7c107f2bba23b5c37473a (diff) | |
download | rneovim-9b447c7ce5bd81d576bcc9253ed77416d9baf59b.tar.gz rneovim-9b447c7ce5bd81d576bcc9253ed77416d9baf59b.tar.bz2 rneovim-9b447c7ce5bd81d576bcc9253ed77416d9baf59b.zip |
vim-patch:9.0.0088: pattern for detecting bitbake files is not sufficient (#19547)
Problem: Pattern for detecting bitbake files is not sufficient.
Solution: Adjust the pattern. (Gregory Anders, closes vim/vim#10743)
https://github.com/vim/vim/commit/30e212dac1d29536883c36918a465a38d81d6413
-rw-r--r-- | runtime/autoload/dist/ft.vim | 2 | ||||
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 2 | ||||
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 25 |
3 files changed, 27 insertions, 2 deletions
diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 9e30ae1f51..a2f485dd67 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -519,7 +519,7 @@ func dist#ft#FTinc() " headers so assume POV-Ray elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? s:ft_pascal_keywords setf pascal - elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = ' + elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '[A-Z][A-Za-z0-9_:${}]*\s\+\%(??\|[?:+]\)\?= ' setf bitbake else call dist#ft#FTasmsyntax() diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 8c10517687..14f076717f 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -554,7 +554,7 @@ function M.inc(bufnr) -- headers so assume POV-Ray elseif findany(lines, { '^%s{', '^%s%(%*' }) or matchregex(lines, pascal_keywords) then return 'pascal' - elseif findany(lines, { '^%s*inherit ', '^%s*require ', '^%s*%w+%s+= ' }) then + elseif findany(lines, { '^%s*inherit ', '^%s*require ', '^%s*%u[%w_:${}]*%s+%??[?:+]?= ' }) then return 'bitbake' else local syntax = M.asm_syntax(bufnr) diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index 53f8d4f3ef..856235acef 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -1861,6 +1861,31 @@ func Test_inc_file() call assert_equal('bitbake', &filetype) bwipe! + call writefile(['S = "${WORKDIR}"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['DEPENDS:append = " somedep"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['MACHINE ??= "qemu"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['PROVIDES := "test"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + + call writefile(['RDEPENDS_${PN} += "bar"'], 'Xfile.inc') + split Xfile.inc + call assert_equal('bitbake', &filetype) + bwipe! + " asm call writefile(['asmsyntax=bar'], 'Xfile.inc') split Xfile.inc |