]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0025: filetype: cshtml incorrectly recognized v9.2.0025
authortris203 <admin@snappeh.com>
Wed, 18 Feb 2026 22:00:09 +0000 (22:00 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 18 Feb 2026 22:00:09 +0000 (22:00 +0000)
Problem:  filetype: cshtml incorrectly recognized, razor files are not
          recognized
Solution: Detect *.cshtml and *.razor files as razor filetype
          (tris203)

Reference:
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/razor?view=aspnetcore-10.0

closes: #19207

Signed-off-by: tris203 <admin@snappeh.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/dist/ft.vim
runtime/filetype.vim
src/testdir/test_filetype.vim
src/version.c

index 32f8fb6e2f984d06049426e75eef1f42e7908af9..d5bd636bde0450339a318ce31ecbd8103d3e99ec 100644 (file)
@@ -3,7 +3,7 @@ vim9script
 # Vim functions for file type detection
 #
 # Maintainer:          The Vim Project <https://github.com/vim/vim>
-# Last Change:         2026 Feb 06
+# Last Change:         2026 Feb 18
 # Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 # These functions are moved here from runtime/filetype.vim to make startup
@@ -2571,6 +2571,9 @@ const ft_from_ext = {
   "rakumod": "raku",
   "rakudoc": "raku",
   "rakutest": "raku",
+  # Razor
+  "cshtml": "razor",
+  "razor": "razor",
   # Renderman Interface Bytestream
   "rib": "rib",
   # Rego Policy Language
index bfdf46e1a83e846d65ff64ce3eb7e269cabedbd8..470325d1380c8223171e295288188b5ab534b93e 100644 (file)
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:          The Vim Project <https://github.com/vim/vim>
-" Last Change:         2026 Jan 20
+" Last Change:         2026 Feb 18
 " Former Maintainer:   Bram Moolenaar <Bram@vim.org>
 
 " If the filetype can be detected from extension or file name(the final path component),
@@ -535,7 +535,6 @@ au BufNewFile,BufRead init.trans,*/etc/translate-shell,.trans       setf clojure
 
 " HTML (.stm for server side, .shtml is server-side or superhtml)
 au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm  call dist#ft#FThtml()
-au BufNewFile,BufRead *.cshtml                 setf html
 
 " Host config
 au BufNewFile,BufRead */etc/host.conf          setf hostconf
index 8b59a36458aa1ee4304e70e5f7fa1ec3674dacb6..82caa2baf3fb451612ecef2395aaad590aaca07a 100644 (file)
@@ -379,7 +379,7 @@ def s:GetFilenameChecks(): dict<list<string>>
     hostconf: ['/etc/host.conf', 'any/etc/host.conf'],
     hostsaccess: ['/etc/hosts.allow', '/etc/hosts.deny', 'any/etc/hosts.allow', 'any/etc/hosts.deny'],
     # file.component.html should be HTML, not Angular, see #13594
-    html: ['file.html', 'file.htm', 'file.cshtml', 'file.component.html'],
+    html: ['file.html', 'file.htm', 'file.component.html'],
     htmlm4: ['file.html.m4'],
     httest: ['file.htt', 'file.htb'],
     http: ['file.http'],
@@ -680,6 +680,7 @@ def s:GetFilenameChecks(): dict<list<string>>
     rapid: ['file.sysx', 'file.Sysx', 'file.SysX', 'file.SYSx', 'file.SYSX', 'file.modx', 'file.Modx', 'file.ModX', 'file.MODx', 'file.MODX'],
     rasi: ['file.rasi', 'file.rasinc'],
     ratpoison: ['.ratpoisonrc', 'ratpoisonrc'],
+    razor: ['file.cshtml', 'file.razor'],
     rbs: ['file.rbs'],
     rc: ['file.rc', 'file.rch'],
     rcs: ['file,v'],
index 6618340d75d62f4277d49281861fd2d36c594b1f..fa0ca1f30d6649259978347daeb53dfe05ad6e16 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    25,
 /**/
     24,
 /**/