]> git.feebdaed.xyz Git - 0xmirror/vim.git/commitdiff
patch 9.1.2027: filetype: bicep filetype used for 2 bicep file types
authorScott McKendry <me@scottmckendry.tech>
Sat, 27 Dec 2025 15:15:35 +0000 (15:15 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 27 Dec 2025 15:20:39 +0000 (15:20 +0000)
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: #19026

Signed-off-by: Scott McKendry <me@scottmckendry.tech>
Signed-off-by: Christian Brabandt <cb@256bit.org>
.github/MAINTAINERS
runtime/autoload/dist/ft.vim
runtime/ftplugin/bicep-params.vim [new file with mode: 0644]
runtime/ftplugin/bicep.vim [new file with mode: 0644]
src/testdir/test_filetype.vim
src/version.c

index 64ec257261475101135d2f3aee1336e81ec70cd3..94c9eff887232c9843839a47e20a95a0b4152d45 100644 (file)
@@ -127,6 +127,8 @@ runtime/ftplugin/asy.vim                            @avidseeker
 runtime/ftplugin/autohotkey.vim                                @telemachus
 runtime/ftplugin/awk.vim                               @dkearns
 runtime/ftplugin/basic.vim                             @dkearns
+runtime/ftplugin/bicep.vim                             @scottmckendry
+runtime/ftplugin/bicep-params.vim                              @scottmckendry
 runtime/ftplugin/brighterscript.vim                    @ribru17
 runtime/ftplugin/brightscript.vim                      @ribru17
 runtime/ftplugin/bst.vim                               @tpope
index 0ab087b0f59b2e35bc64f9df1c86e3a34f48fb86..a81768bbde28aefefb6fd8a107d3e7b5b4a0ba80 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim functions for file type detection
 #
 # Maintainer:          The Vim Project <https://github.com/vim/vim>
-# Last Change:         2025 Dec 26
+# Last Change:         2025 Dec 27
 # Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 # These functions are moved here from runtime/filetype.vim to make startup
@@ -1746,7 +1746,7 @@ const ft_from_ext = {
   "bst": "bst",
   # Bicep
   "bicep": "bicep",
-  "bicepparam": "bicep",
+  "bicepparam": "bicep-params",
   # BIND zone
   "zone": "bindzone",
   # Blank
diff --git a/runtime/ftplugin/bicep-params.vim b/runtime/ftplugin/bicep-params.vim
new file mode 100644 (file)
index 0000000..7cc2d85
--- /dev/null
@@ -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 (file)
index 0000000..f142daf
--- /dev/null
@@ -0,0 +1,14 @@
+" Vim filetype plugin
+" Language:    Bicep
+" Maintainer:  Scott McKendry <me@scottmckendry.tech>
+" 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<"
index b3e6fc171953d2f8aea0b08fef426ce53a9aa180..cdf854bdd1a001070803787734f293625d5e597b 100644 (file)
@@ -140,7 +140,8 @@ def s:GetFilenameChecks(): dict<list<string>>
     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'],
index 14e983beaac1dc8dd8313a2e18292f217a7289d7..a4d0ed19afb67a5985487cc8e3c58e53d9946255 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2027,
 /**/
     2026,
 /**/