aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Atkinson <jesse@jsatk.us>2021-08-22 14:40:59 -0700
committerGitHub <noreply@github.com>2021-08-22 14:40:59 -0700
commitda5d023c97d7e156bc9e264cc9d8a9f473b9bba6 (patch)
tree08951833855e3ea722efdaba376421978bfa5e5d
parentc2a211b8e3e00dfae594ccbd9a107aef85a9919c (diff)
downloadrneovim-da5d023c97d7e156bc9e264cc9d8a9f473b9bba6.tar.gz
rneovim-da5d023c97d7e156bc9e264cc9d8a9f473b9bba6.tar.bz2
rneovim-da5d023c97d7e156bc9e264cc9d8a9f473b9bba6.zip
vim-patch:8.2.3358: structurizr files are not recognized (#15417)
Problem: Structurizr files are not recognized. Solution: Recognize the file by contents. (Bastian Venthur, closes vim/vim#8764) https://github.com/vim/vim/commit/dea561111a5761bf99397a246b8baa43e73288de
-rw-r--r--runtime/filetype.vim9
-rw-r--r--src/nvim/testdir/test_filetype.vim18
2 files changed, 24 insertions, 3 deletions
diff --git a/runtime/filetype.vim b/runtime/filetype.vim
index 9c75a49ac1..333da58128 100644
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -533,8 +533,13 @@ au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula
" 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/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim
index c155dbad50..4d29d18330 100644
--- a/src/nvim/testdir/test_filetype.vim
+++ b/src/nvim/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'],
@@ -809,4 +808,21 @@ func Test_ex_file()
filetype off
endfunc
+func Test_dsl_file()
+ filetype on
+
+ call writefile([' <!doctype dsssl-spec ['], 'dslfile.dsl')
+ split dslfile.dsl
+ call assert_equal('dsl', &filetype)
+ bwipe!
+
+ call writefile(['workspace {'], 'dslfile.dsl')
+ split dslfile.dsl
+ call assert_equal('structurizr', &filetype)
+ bwipe!
+
+ call delete('dslfile.dsl')
+ filetype off
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab