Patch 8.2.2085
Problem: Qt translation file is recognized as typescript.
Solution: Check the first line for "<?xml". (closes #7418)
Files: runtime/filetype.vim, src/testdir/test_filetype.vim
*** ../vim-8.2.2084/runtime/filetype.vim 2020-11-24 20:13:21.546432726 +0100
--- runtime/filetype.vim 2020-12-03 21:04:16.673227390 +0100
***************
*** 1762,1769 ****
" TWIG files
au BufNewFile,BufReadPost *.twig setf twig
! " Typescript
! au BufNewFile,BufReadPost *.ts setf typescript
" TypeScript with React
au BufNewFile,BufRead *.tsx setf typescriptreact
--- 1763,1775 ----
" TWIG files
au BufNewFile,BufReadPost *.twig setf twig
! " Typescript or Qt translation file (which is XML)
! au BufNewFile,BufReadPost *.ts
! \ if getline(1) =~ '<?xml' |
! \ setf xml |
! \ else |
! \ setf typescript |
! \ endif
" TypeScript with React
au BufNewFile,BufRead *.tsx setf typescriptreact
*** ../vim-8.2.2084/src/testdir/test_filetype.vim 2020-11-24 20:13:21.546432726 +0100
--- src/testdir/test_filetype.vim 2020-12-03 21:07:41.628575829 +0100
***************
*** 487,493 ****
\ 'tssgm': ['file.tssgm'],
\ 'tssop': ['file.tssop'],
\ 'twig': ['file.twig'],
- \ 'typescript': ['file.ts'],
\ 'typescriptreact': ['file.tsx'],
\ 'uc': ['file.uc'],
\ 'udevconf': ['/etc/udev/udev.conf', 'any/etc/udev/udev.conf'],
--- 487,492 ----
***************
*** 706,711 ****
--- 705,727 ----
bwipe!
call delete('Xfile.hook')
+ filetype off
+ endfunc
+
+ func Test_ts_file()
+ filetype on
+
+ call writefile(['<?xml version="1.0" encoding="utf-8"?>'], 'Xfile.ts')
+ split Xfile.ts
+ call assert_equal('xml', &filetype)
+ bwipe!
+
+ call writefile(['// looks like Typescript'], 'Xfile.ts')
+ split Xfile.ts
+ call assert_equal('typescript', &filetype)
+ bwipe!
+
+ call delete('Xfile.hook')
filetype off
endfunc
*** ../vim-8.2.2084/src/version.c 2020-12-03 19:54:38.181924268 +0100
--- src/version.c 2020-12-03 21:07:58.180523219 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2085,
/**/
--
TIM: Too late.
ARTHUR: What?
TIM: There he is!
[They all turn, and see a large white RABBIT lollop a few yards out of the
cave. Accompanied by terrifying chord and jarring metallic monster noise.]
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///