Skip to content

Commit dea5611

Browse files
venthurbrammool
authored andcommitted
patch 8.2.3358: structurizr files are not recognized
Problem: Structurizr files are not recognized. Solution: Recognize the file by contents. (Bastian Venthur, closes #8764)
1 parent 02f8694 commit dea5611

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

runtime/filetype.vim

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,13 @@ au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula
537537
" Datascript
538538
au BufNewFile,BufRead *.ds setf datascript
539539

540-
" dsl
541-
au BufNewFile,BufRead *.dsl setf dsl
540+
" dsl: DSSSL or Structurizr
541+
au BufNewFile,BufRead *.dsl
542+
\ if getline(1) =~ '^\s*<\!' |
543+
\ setf dsl |
544+
\ else |
545+
\ setf structurizr |
546+
\ endif
542547

543548
" DTD (Document Type Definition for XML)
544549
au BufNewFile,BufRead *.dtd setf dtd

src/testdir/test_filetype.vim

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ let s:filename_checks = {
151151
\ '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'],
152152
\ 'dot': ['file.dot', 'file.gv'],
153153
\ 'dracula': ['file.drac', 'file.drc', 'filelvs', 'filelpe', 'drac.file', 'lpe', 'lvs', 'some-lpe', 'some-lvs'],
154-
\ 'dsl': ['file.dsl'],
155154
\ 'dtd': ['file.dtd'],
156155
\ 'dts': ['file.dts', 'file.dtsi'],
157156
\ 'dune': ['jbuild', 'dune', 'dune-project', 'dune-workspace'],
@@ -834,4 +833,21 @@ func Test_ex_file()
834833
filetype off
835834
endfunc
836835

836+
func Test_dsl_file()
837+
filetype on
838+
839+
call writefile([' <!doctype dsssl-spec ['], 'dslfile.dsl')
840+
split dslfile.dsl
841+
call assert_equal('dsl', &filetype)
842+
bwipe!
843+
844+
call writefile(['workspace {'], 'dslfile.dsl')
845+
split dslfile.dsl
846+
call assert_equal('structurizr', &filetype)
847+
bwipe!
848+
849+
call delete('dslfile.dsl')
850+
filetype off
851+
endfunc
852+
837853
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3358,
758760
/**/
759761
3357,
760762
/**/

0 commit comments

Comments
 (0)