0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.1.1930: cannot recognize .jsx and .tsx files

Problem:    Cannot recognize .jsx and .tsx files.
Solution:   Recognize them as javascriptreact and typescriptreact.
            (closes #4830)
This commit is contained in:
Bram Moolenaar
2019-08-26 21:28:15 +02:00
parent 8e95636a28
commit 92852cee3f
6 changed files with 19 additions and 3 deletions

View File

@@ -798,7 +798,10 @@ au BufNewFile,BufRead *.java,*.jav setf java
au BufNewFile,BufRead *.jj,*.jjt setf javacc
" JavaScript, ECMAScript
au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx,*.mjs setf javascript
au BufNewFile,BufRead *.js,*.javascript,*.es,*.mjs setf javascript
" JavaScript with React
au BufNewFile,BufRead *.jsx setf javascriptreact
" Java Server Pages
au BufNewFile,BufRead *.jsp setf jsp
@@ -1709,6 +1712,9 @@ au BufNewFile,BufReadPost *.twig setf twig
" Typescript
au BufNewFile,BufReadPost *.ts setf typescript
" TypeScript with React
au BufNewFile,BufRead *.tsx setf typescriptreact
" Motif UIT/UIL files
au BufNewFile,BufRead *.uit,*.uil setf uil

View File

@@ -0,0 +1,2 @@
" Placeholder for backwards compatilibity: .jsx used to stand for JavaScript.
source %:h/javascript.vim

View File

@@ -0,0 +1,2 @@
" Placeholder for backwards compatilibity: .jsx used to stand for JavaScript.
source %:h/javascript.vim

View File

@@ -0,0 +1,2 @@
" Placeholder for backwards compatilibity: .jsx used to stand for JavaScript.
source %:h/javascript.vim

View File

@@ -221,7 +221,8 @@ let s:filename_checks = {
\ 'jam': ['file.jpl', 'file.jpr'],
\ 'java': ['file.java', 'file.jav'],
\ 'javacc': ['file.jj', 'file.jjt'],
\ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.jsx', 'file.mjs'],
\ 'javascript': ['file.js', 'file.javascript', 'file.es', 'file.mjs'],
\ 'javascriptreact': ['file.jsx'],
\ 'jess': ['file.clp'],
\ 'jgraph': ['file.jgr'],
\ 'jovial': ['file.jov', 'file.j73', 'file.jovial'],
@@ -455,6 +456,7 @@ let s:filename_checks = {
\ 'tssop': ['file.tssop'],
\ 'twig': ['file.twig'],
\ 'typescript': ['file.ts'],
\ 'typescriptreact': ['file.tsx'],
\ 'uc': ['file.uc'],
\ 'udevconf': ['/etc/udev/udev.conf'],
\ 'udevperm': ['/etc/udev/permissions.d/file.permissions'],
@@ -609,5 +611,5 @@ endfunc
func Test_setfiletype_completion()
call feedkeys(":setfiletype java\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"setfiletype java javacc javascript', @:)
call assert_equal('"setfiletype java javacc javascript javascriptreact', @:)
endfunc

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1930,
/**/
1929,
/**/