vim-patch:9.0.0602: new TypeScript extensions are not recognized

Problem:    New TypeScript extensions are not recognized.
Solution:   Recognize .mts and .cts files. (closes vim/vim#11237)
7fc6c0e4da
This commit is contained in:
Christian Clason 2022-09-27 13:03:28 +02:00
parent e176f9dacf
commit fe0727a1bf
3 changed files with 10 additions and 4 deletions

View File

@ -771,8 +771,8 @@ au BufNewFile,BufRead gitolite.conf setf gitolite
au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl
" Glimmer-flavored TypeScript and JavaScript " Glimmer-flavored TypeScript and JavaScript
au BufNewFile,BufRead *.gts setf typescript.glimmer au BufNewFile,BufRead *.gts setf typescript.glimmer
au BufNewFile,BufRead *.gjs setf javascript.glimmer au BufNewFile,BufRead *.gjs setf javascript.glimmer
" Gnuplot scripts " Gnuplot scripts
au BufNewFile,BufRead *.gpi,.gnuplot setf gnuplot au BufNewFile,BufRead *.gpi,.gnuplot setf gnuplot
@ -2090,7 +2090,7 @@ au BufNewFile,BufReadPost *.tutor setf tutor
" TWIG files " TWIG files
au BufNewFile,BufReadPost *.twig setf twig au BufNewFile,BufReadPost *.twig setf twig
" Typescript or Qt translation file (which is XML) " TypeScript or Qt translation file (which is XML)
au BufNewFile,BufReadPost *.ts au BufNewFile,BufReadPost *.ts
\ if getline(1) =~ '<?xml' | \ if getline(1) =~ '<?xml' |
\ setf xml | \ setf xml |
@ -2098,6 +2098,9 @@ au BufNewFile,BufReadPost *.ts
\ setf typescript | \ setf typescript |
\ endif \ endif
" TypeScript module and common
au BufNewFile,BufRead *.mts,*.cts setf typescript
" TypeScript with React " TypeScript with React
au BufNewFile,BufRead *.tsx setf typescriptreact au BufNewFile,BufRead *.tsx setf typescriptreact
@ -2289,7 +2292,7 @@ au BufNewFile,BufRead *.fsproj,*.fsproj.user setf xml
au BufNewFile,BufRead *.vbproj,*.vbproj.user setf xml au BufNewFile,BufRead *.vbproj,*.vbproj.user setf xml
" Qt Linguist translation source and Qt User Interface Files are XML " Qt Linguist translation source and Qt User Interface Files are XML
" However, for .ts Typescript is more common. " However, for .ts TypeScript is more common.
au BufNewFile,BufRead *.ui setf xml au BufNewFile,BufRead *.ui setf xml
" TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull) " TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull)

View File

@ -1021,6 +1021,8 @@ local extension = {
ts = function(path, bufnr) ts = function(path, bufnr)
return M.getlines(bufnr, 1):find('<%?xml') and 'xml' or 'typescript' return M.getlines(bufnr, 1):find('<%?xml') and 'xml' or 'typescript'
end, end,
mts = 'typescript',
cts = 'typescript',
tsx = 'typescriptreact', tsx = 'typescriptreact',
uc = 'uc', uc = 'uc',
uit = 'uil', uit = 'uil',

View File

@ -583,6 +583,7 @@ let s:filename_checks = {
\ 'tssop': ['file.tssop'], \ 'tssop': ['file.tssop'],
\ 'tsv': ['file.tsv'], \ 'tsv': ['file.tsv'],
\ 'twig': ['file.twig'], \ 'twig': ['file.twig'],
\ 'typescript': ['file.mts', 'file.cts'],
\ 'typescript.glimmer': ['file.gts'], \ 'typescript.glimmer': ['file.gts'],
\ 'typescriptreact': ['file.tsx'], \ 'typescriptreact': ['file.tsx'],
\ 'uc': ['file.uc'], \ 'uc': ['file.uc'],