Comments (18)
@yuezk from what I know they are no official vim filetypes so I set them manually
(I have no plugin who does this)
autocmd bufnewfile,bufread *.jsx set filetype=javascript.jsx
autocmd bufnewfile,bufread *.tsx set filetype=typescript.tsx
Someone might however set the filetype for javascriptreact
or typescriptreact
instead and have no syntax highlighting. I thought it would just be a nice addition for that case.
from vim-jsx-pretty.
Wondering which plugin will set the filetypes to javascriptreact / typescriptreact?
from vim-jsx-pretty.
@yuezk plugins that implement Microsoft language protocol LSP specification. coc.nvim has a fallback if someone uses javascript.jsx
or typescript.tsx
though
from vim-jsx-pretty.
This plugin has no special logic for filetypes. It works well for filetypes which are javascript/typescript, javascript.jsx/typescript.tsx.
Does the rest part of your JavaScript code highlight correctly when using javascriptreact / typescriptreact?
from vim-jsx-pretty.
No this plugin only works when using javascript.jsx
/ typescript.tsx
not when using javascriptreact
/ typescriptreact
hence this issue.
from vim-jsx-pretty.
@impulse What I mean is which javascript highlighting plugin do you use? (i.e., are you using pangloss/vim-javascript
or yajs.vim
or whatever?) Do they work well for the javascriptreact
/ typescriptreact
filetypes?
from vim-jsx-pretty.
@yuezk I use the following:
Plug 'pangloss/vim-javascript'
Plug 'leafgarland/typescript-vim'
Plug 'maxmellon/vim-jsx-pretty'
There is no syntax highlighting for javascriptreact (javascript.jsx is the above split)
from vim-jsx-pretty.
Do you know which plugin changed the filetype to javascriptreact
?
from vim-jsx-pretty.
Currently, I have no idea how to implement this.
from vim-jsx-pretty.
Update: I opened up an issue over at the vim repo and talked with the author. He did not like making the dot syntax official, however he accepted the proposal on making javascriptreact
and typescriptreact
official vim filetypes.
Unfortunately this would be my only affected plugin by that change. I'll take a look at the source if I can come up with a solution.
Discussion for reference: vim/vim#4830
from vim-jsx-pretty.
@impulse Appreciate for your follow up.
But for React users who use .js
as the extension, the filetype is still javascript
, right? If it is that case, I want to know if the coc.vim
plugin works as expected?
from vim-jsx-pretty.
@impulse Appreciate for your follow up.
But for React users who use
.js
as the extension, the filetype is stilljavascript
, right? If it is that case, I want to know if thecoc.vim
plugin works as expected?
Yeah .js will continue to be filetype javascript
. The coc.vim plugin works as it would in VSCode since language servers triggers on both suffixes. Extensions and snippets usually define which filetypes are supported in their package.json
.
from vim-jsx-pretty.
Not sure if you guys changed something in the meanwhile but the issue is resolved for me.
from vim-jsx-pretty.
Actually, we didn't change anything about this issue. 😅
from vim-jsx-pretty.
Just ran into this myself. Pretty sure the offending plugin is coctsserver. I added the two autocmd's that @impulse mentioned to my vimrc and now appear to have both tsserver fixes and vim-jsx-pretty highlighting and indentation. Whoo!
from vim-jsx-pretty.
@Trial-In-Error Thanks for your feedback, glad it works well. BTW, I'm wondering about the version of your Vim.
from vim-jsx-pretty.
nvim @ v0.4.2
$ vim --version
NVIM v0.4.2
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/build/config -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/src -I/usr/local/include -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/deps-build/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/build/src/nvim/auto -I/tmp/neovim-20190916-19272-18joql2/neovim-0.4.2/build/include
Compiled by [email protected]
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.2/share/nvim"
Run :checkhealth for more info
from vim-jsx-pretty.
@Trial-In-Error I am actually not using those autocmds anymore on the same nvim version. It works fine for the javascriptreact and typescriptreact filetypes for me.
My dotfiles for reference: https://github.com/impulse/dotfiles/blob/master/vim/.vimrc
from vim-jsx-pretty.
Related Issues (20)
- [Question] Using Emmet with vim-jsx-pretty HOT 2
- typescript: misaligned indentation when using function shorthand with generic HOT 4
- typescript: misaligned indentation for `=` in template literal HOT 4
- Not matching JSX with dot separator HOT 1
- Great documentation HOT 1
- Dealing with tags interspersed in blocks of text
- Typescript indent failing for multiline properties
- jsxTagName should be same as htmlTagName
- Different formatting than expected HOT 1
- Function declaration's closing bracket highlighted as error HOT 3
- Highlight type arguments after jsxComponentName
- Highlighting issue with colorscheme HOT 2
- Closing tag doesn't get colored - Gruvbox HOT 2
- [Feature] Highlight when call function HOT 2
- highlighting fails on closing parens HOT 3
- Matchit support has problems with unclosed tags
- Weird highlight using vim-polygot HOT 1
- Broken .tsx highlighting for arrow functions using generics
- Problem syntax HOT 2
- Is there a reason why Line Comments are being redefined?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-jsx-pretty.