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 <admin@snappeh.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
tris203
2026-02-18 22:00:09 +00:00
committed by Christian Brabandt
parent 6cc291da06
commit 68dbb58d51
4 changed files with 9 additions and 4 deletions
+4 -1
View 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
+1 -2
View 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
+2 -1
View 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'],
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
25,
/**/
24,
/**/