]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.0055: bitbake files are not detected v9.0.0055 v9.0.0056
authorGregory Anders <greg@gpanders.com>
Sat, 16 Jul 2022 16:46:47 +0000 (17:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 16 Jul 2022 16:46:47 +0000 (17:46 +0100)
Problem:    Bitbake files are not detected.
Solution:   Add bitbake filetype detection by file name and contents. (Gregory
            Anders, closes #10697)

runtime/autoload/dist/ft.vim
runtime/filetype.vim
src/testdir/test_filetype.vim
src/version.c

index a96bdf5e72be1d6e6b5a11e4955567cc6886c925..708a42a050287a25263eb74a3a62bd00b2d1796d 100644 (file)
@@ -519,12 +519,14 @@ export def FTinc()
     # headers so assume POV-Ray
     elseif lines =~ '^\s*\%({\|(\*\)' || lines =~? ft_pascal_keywords
       setf pascal
+    elseif lines =~# '\<\%(require\|inherit\)\>' || lines =~# '\w\+ = '
+      setf bitbake
     else
       FTasmsyntax()
       if exists("b:asmsyntax")
-       exe "setf " .. fnameescape(b:asmsyntax)
+        exe "setf " .. fnameescape(b:asmsyntax)
       else
-       setf pov
+        setf pov
       endif
     endif
   endif
index 42bd4be6a609bfc5f604e50cfa1bc48f3c4497b0..761ed3f283ee814174e95b01d64d83d2cf328042 100644 (file)
@@ -252,6 +252,9 @@ au BufNewFile,BufRead *.db                  call dist#ft#BindzoneCheck('')
 " Blank
 au BufNewFile,BufRead *.bl                     setf blank
 
+" Bitbake
+au BufNewFile,BufRead *.bb,*.bbappend,*.bbclass,*/build/conf/*.conf,*/meta{-*,}/conf/*.conf    setf bitbake
+
 " Blkid cache file
 au BufNewFile,BufRead */etc/blkid.tab,*/etc/blkid.tab.old   setf xml
 
index 2b7b79765d2ae18e24cc7fbd0658ac3fb8ffd60e..4be8cdc9bd0d699efd34ba464a681254feb40356 100644 (file)
@@ -83,6 +83,7 @@ let s:filename_checks = {
     \ 'bib': ['file.bib'],
     \ 'bicep': ['file.bicep'],
     \ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file'],
+    \ 'bitbake': ['file.bb', 'file.bbappend', 'file.bbclass', 'build/conf/local.conf', 'meta/conf/layer.conf', 'build/conf/bbappend.conf', 'meta-layer/conf/distro/foo.conf'],
     \ 'blank': ['file.bl'],
     \ 'bsdl': ['file.bsd', 'file.bsdl', 'bsd', 'some-bsd'],
     \ 'bst': ['file.bst'],
@@ -1816,5 +1817,58 @@ func Test_sig_file()
   filetype off
 endfunc
 
+func Test_inc_file()
+  filetype on
+
+  call writefile(['this is the fallback'], 'Xfile.inc')
+  split Xfile.inc
+  call assert_equal('pov', &filetype)
+  bwipe!
+
+  let g:filetype_inc = 'foo'
+  split Xfile.inc
+  call assert_equal('foo', &filetype)
+  bwipe!
+  unlet g:filetype_inc
+
+  " aspperl
+  call writefile(['perlscript'], 'Xfile.inc')
+  split Xfile.inc
+  call assert_equal('aspperl', &filetype)
+  bwipe!
+
+  " aspvbs
+  call writefile(['<% something'], 'Xfile.inc')
+  split Xfile.inc
+  call assert_equal('aspvbs', &filetype)
+  bwipe!
+
+  " php
+  call writefile(['<?php'], 'Xfile.inc')
+  split Xfile.inc
+  call assert_equal('php', &filetype)
+  bwipe!
+
+  " pascal
+  call writefile(['program'], 'Xfile.inc')
+  split Xfile.inc
+  call assert_equal('pascal', &filetype)
+  bwipe!
+
+  " bitbake
+  call writefile(['require foo'], 'Xfile.inc')
+  split Xfile.inc
+  call assert_equal('bitbake', &filetype)
+  bwipe!
+
+  " asm
+  call writefile(['asmsyntax=foo'], 'Xfile.inc')
+  split Xfile.inc
+  call assert_equal('foo', &filetype)
+  bwipe!
+
+  call delete('Xfile.inc')
+  filetype off
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
index 8ea00e28390fd76141772f9736388bbb5e2e68f3..f2304f326d5fc95f6dbe37dd2e8a7c39a6db3603 100644 (file)
@@ -735,6 +735,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    55,
 /**/
     54,
 /**/