othree / es.next.syntax.vim

ES.Next syntax for Vim
MIT License
125 stars 7 forks source link

Breaks JSX props with inline functions #16

Closed dariocravero closed 5 years ago

dariocravero commented 6 years ago

Hi,

I don't know if this belongs here or not, so feel free to redirect me elsewhere.

I've found that when this plugin is used together with vim-jsx it breaks at inline JSX props containing arrow functions like onClick={() => this.setState({ isShowing: !state.isShowing })}.

Here's the broken screenshot:

screen shot 2018-06-30 at 13 24 05

I tracked it down to the type hint definition for javascriptArrowFuncDef. Without it, it renders fine:

screen shot 2018-06-30 at 13 23 52

I have no idea how to fix it though, would you know how to go about it? Thanks!

Here's the code in case it comes in handy to test it:

import Gif from './Gif.js'
import React from 'react'

class App extends React.Component {
  state = {
    isShowing: true,
  }

  render() {
    const { props, state } = this

    return (
      <div>
        <button onClick={() => ''}>
          {state.isShowing ? 'hide' : 'show'}
        </button>

        {state.isShowing && (
          <div>
            {props.list.map(image => <Gif key={image.id} {...image} />)}
          </div>
        )}
      </div>
    )
  }
}

export default App
othree commented 5 years ago

Hi, I tested this on latest revision and it works fine now. Can you check again?

dariocravero commented 5 years ago

It's perfect now, thanks! :)