Mercurial > vim
changeset 17867:180fb9981255 v8.1.1930
patch 8.1.1930: cannot recognize .jsx and .tsx files
Commit: https://github.com/vim/vim/commit/92852cee3fcff1dc6ce12387b234634e73267b22
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 26 21:28:15 2019 +0200
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 26 Aug 2019 21:30:04 +0200 |
parents | 53402dbe1ee1 |
children | 5d329a40052a |
files | runtime/filetype.vim runtime/ftplugin/javascriptreact.vim runtime/indent/javascriptreact.vim runtime/syntax/javascriptreact.vim src/testdir/test_filetype.vim src/version.c |
diffstat | 6 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -798,7 +798,10 @@ au BufNewFile,BufRead *.java,*.jav setf 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 t " 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
new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/javascriptreact.vim @@ -0,0 +1,2 @@ +" Placeholder for backwards compatilibity: .jsx used to stand for JavaScript. +source %:h/javascript.vim
new file mode 100644 --- /dev/null +++ b/runtime/indent/javascriptreact.vim @@ -0,0 +1,2 @@ +" Placeholder for backwards compatilibity: .jsx used to stand for JavaScript. +source %:h/javascript.vim
new file mode 100644 --- /dev/null +++ b/runtime/syntax/javascriptreact.vim @@ -0,0 +1,2 @@ +" Placeholder for backwards compatilibity: .jsx used to stand for JavaScript. +source %:h/javascript.vim
--- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -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