From 7f1d7271d5d3cf3af8075766e834f171e488aef6 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 28 Dec 2025 08:16:20 +0800 Subject: [PATCH] vim-patch:9.1.2027: filetype: bicep filetype used for 2 bicep file types (#37130) Problem: filetype: bicep filetype used for 2 bicep file types Solution: Detect *.bicepparam files as bicep-param filetype, include new bicep-params and bicep filetype plugin (Scott McKendry) The bicep language server handles parameter files differently than regular bicep files. Treating them the same at the editor level leads to false positive diagnostics in the editor. References: Bicep Language Constants: - https://github.com/Azure/bicep/blob/51392d32ca2c8b94b1bb7a255e78e1d559d12573/src/Bicep.Core/LanguageConstants.cs#L23 VS Code Extension definition: - https://github.com/Azure/bicep/blob/51392d32ca2c8b94b1bb7a255e78e1d559d12573/src/vscode-bicep/package.json#L47 closes: vim/vim#19026 https://github.com/vim/vim/commit/4e722fdfdd987c11136e3533bd65d0ed4d15f829 Co-authored-by: Scott McKendry --- runtime/ftplugin/bicep-params.vim | 3 +++ runtime/ftplugin/bicep.vim | 14 ++++++++++++++ runtime/lua/vim/filetype.lua | 2 +- test/old/testdir/test_filetype.vim | 3 ++- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 runtime/ftplugin/bicep-params.vim create mode 100644 runtime/ftplugin/bicep.vim diff --git a/runtime/ftplugin/bicep-params.vim b/runtime/ftplugin/bicep-params.vim new file mode 100644 index 0000000000..7cc2d85126 --- /dev/null +++ b/runtime/ftplugin/bicep-params.vim @@ -0,0 +1,3 @@ +" Placeholder for maximum compatibility. While bicepparam files are treated as distinct filetypes, +" they are should share the same ftplugin settings as bicep files. +runtime! ftplugin/bicep.vim diff --git a/runtime/ftplugin/bicep.vim b/runtime/ftplugin/bicep.vim new file mode 100644 index 0000000000..f142daf135 --- /dev/null +++ b/runtime/ftplugin/bicep.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin +" Language: Bicep +" Maintainer: Scott McKendry +" Last Change: 2025 Dec 27 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setlocal comments=s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +let b:undo_ftplugin = "setlocal comments< commentstring<" diff --git a/runtime/lua/vim/filetype.lua b/runtime/lua/vim/filetype.lua index 0e74321294..02c0a83bf9 100644 --- a/runtime/lua/vim/filetype.lua +++ b/runtime/lua/vim/filetype.lua @@ -260,7 +260,7 @@ local extension = { com = detect_seq(detect.bindzone, 'dcl'), db = detect.bindzone, bicep = 'bicep', - bicepparam = 'bicep', + bicepparam = 'bicep-params', zone = 'bindzone', bb = 'bitbake', bbappend = 'bitbake', diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index ca35b287cc..5112089f73 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -141,7 +141,8 @@ func s:GetFilenameChecks() abort \ 'bdf': ['file.bdf'], \ 'beancount': ['file.beancount'], \ 'bib': ['file.bib'], - \ 'bicep': ['file.bicep', 'file.bicepparam'], + \ 'bicep': ['file.bicep'], + \ 'bicep-params': ['file.bicepparam'], \ 'bindzone': ['named.root', '/bind/db.file', '/named/db.file', 'any/bind/db.file', 'any/named/db.file', 'foobar.zone'], \ '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', 'project-spec/configs/zynqmp-generic-xczu7ev.conf'], \ 'blade': ['file.blade.php'],