# HG changeset patch # User Bram Moolenaar # Date 1629236703 -7200 # Node ID 59a1c9a2ca2e2bcbc0aa220abfca43073a292dc4 # Parent f5a46deb4cc935f1fa6d41d77045ed25262700f0 patch 8.2.3358: structurizr files are not recognized Commit: https://github.com/vim/vim/commit/dea561111a5761bf99397a246b8baa43e73288de Author: Bastian Venthur Date: Tue Aug 17 23:44:54 2021 +0200 patch 8.2.3358: structurizr files are not recognized Problem: Structurizr files are not recognized. Solution: Recognize the file by contents. (Bastian Venthur, closes https://github.com/vim/vim/issues/8764) diff --git a/runtime/filetype.vim b/runtime/filetype.vim --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -537,8 +537,13 @@ au BufNewFile,BufRead *.drac,*.drc,*lvs, " Datascript au BufNewFile,BufRead *.ds setf datascript -" dsl -au BufNewFile,BufRead *.dsl setf dsl +" dsl: DSSSL or Structurizr +au BufNewFile,BufRead *.dsl + \ if getline(1) =~ '^\s*<\!' | + \ setf dsl | + \ else | + \ setf structurizr | + \ endif " DTD (Document Type Definition for XML) au BufNewFile,BufRead *.dtd setf dtd diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -151,7 +151,6 @@ let s:filename_checks = { \ 'dosini': ['.editorconfig', '/etc/pacman.conf', '/etc/yum.conf', 'file.ini', 'npmrc', '.npmrc', 'php.ini', 'php.ini-5', 'php.ini-file', '/etc/yum.repos.d/file', 'any/etc/pacman.conf', 'any/etc/yum.conf', 'any/etc/yum.repos.d/file', 'file.wrap'], \ 'dot': ['file.dot', 'file.gv'], \ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'], - \ 'dsl': ['file.dsl'], \ 'dtd': ['file.dtd'], \ 'dts': ['file.dts', 'file.dtsi'], \ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace'], @@ -834,4 +833,21 @@ func Test_ex_file() filetype off endfunc +func Test_dsl_file() + filetype on + + call writefile(['