vim-patch:9.2.0500: filetype: some html files wrongly recognized as htmlangular (#39880)

Problem:  filetype: some html files are wrongly recognized as htmlangular
Solution: Use the \< atom to anchor ng-template and ng-content to start
          of word (truffle)

Prevent false-positive htmlangular detection on words containing
'ng-template' or 'ng-content' as a substring (e.g. 'song-template',
'sing-content'). Anchor both branches with \< to require a word start,
matching the \<DTD\s\+XHTML\s idiom used five lines below.

related: neovim/neovim#39778.
closes:  vim/vim#20246

354ab1a69e

Co-authored-by: truffle <truffleagent@gmail.com>
This commit is contained in:
zeertzjq
2026-05-19 08:42:05 +08:00
committed by GitHub
parent 450ba41436
commit f3bb21e71d
2 changed files with 22 additions and 1 deletions

View File

@@ -848,7 +848,7 @@ function M.html(_, bufnr)
if
matchregex(
line,
[[@\(if\|for\|defer\|switch\)\|\*\(ngIf\|ngFor\|ngSwitch\|ngTemplateOutlet\)\|ng-template\|ng-content]]
[[@\(if\|for\|defer\|switch\)\|\*\(ngIf\|ngFor\|ngSwitch\|ngTemplateOutlet\)\|\<ng-template\|\<ng-content]]
)
then
return 'htmlangular'