From: tris203 Date: Wed, 18 Feb 2026 22:00:09 +0000 (+0000) Subject: patch 9.2.0025: filetype: cshtml incorrectly recognized X-Git-Tag: v9.2.0025^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68dbb58d5189d1293b0f8e032af6bcb84101bd86;p=thirdparty%2Fvim.git patch 9.2.0025: filetype: cshtml incorrectly recognized 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 Signed-off-by: Christian Brabandt --- diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 32f8fb6e2f..d5bd636bde 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -3,7 +3,7 @@ vim9script # Vim functions for file type detection # # Maintainer: The Vim Project -# Last Change: 2026 Feb 06 +# Last Change: 2026 Feb 18 # Former Maintainer: Bram Moolenaar # 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 diff --git a/runtime/filetype.vim b/runtime/filetype.vim index bfdf46e1a8..470325d138 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: The Vim Project -" Last Change: 2026 Jan 20 +" Last Change: 2026 Feb 18 " Former Maintainer: Bram Moolenaar " 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 diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 8b59a36458..82caa2baf3 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -379,7 +379,7 @@ def s:GetFilenameChecks(): dict> 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> 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'], diff --git a/src/version.c b/src/version.c index 6618340d75..fa0ca1f30d 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 25, /**/ 24, /**/