-
-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty elements don't autoclose in JSX #313
Comments
if you want it
put this into your vimrc. |
Yes, but for JSX it's always an error to produce an empty element without a suffix, whereas for html it's okay to configure it the way you want. |
Ah, I miss your explain sorry. |
@mattn, could we solve this by simply setting |
I suppose another way would be to have a global flag for one to set. Something like |
Did you try set let g:user_emmet_settings = {
\ 'html': {
\ 'empty_element_suffix': 1,
\ }
\} |
I favor the suggestion by @indiesquidge to use "something like I think it's worth noting that the React community and Facebook in particular seem to be moving away from using the As html isn't valid js, the only potential problem I can see is for people using jQuery constructor functionality though my brief experimentation did not show any errors. Considering that emmet will mess up a single line constructor anyway ( |
@mattn, I'm not able to get let g:user_emmet_settings = {
\ 'html': {
\ 'empty_element_suffix': 1,
\ }
\} To work properly. At first I thought you had actually meant for the key to be |
could you please try these configurations commented on following issue? |
Hi, @mattn. The configuration let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\} works, but not as I'd hoped. The default, out-of-the-box snippet expansion looks like this: <img src="**cursor**" alt=""> And with the above code, it now looks like this: <img />
**cursor** I'm a bit confused as to why the whole snippet and cursor placement changed, when all that was desired was a self-closing tag. For instance, having <img src="**cursor**" alt="" /> My question would then be, Is there a way to turn on self-closing tags for JSX files without the snippet being changed beyond the self-closing tag? |
Steps to reproduce:
img
Result:
Expected result:
I did several attempts at a fix, but could not figure it out. Overriding
empty_element_suffix
for jsx does not seem to have any effect.The text was updated successfully, but these errors were encountered: