Prism: JSX spread operator breaks highlighting

Created on 22 Nov 2016  路  3Comments  路  Source: PrismJS/prism

If the JSX spread operator is used inside a tag, highlighting breaks starting at that point. Example code to be highlighted:

class MyComponent extends Component
    render() {
        const {tabs, ...otherProps} = this.props;
        const {currentTab} = this.state;

        return (
            <TabBar
                {...otherProps}
                currentTab={currentTab}
                onTabClick={this.onTabClick}
                tabs={tabs}
            />
        )
    }

If {...otherProps} is there, the props after that are not highlighted. If {...otherProps} is removed, they highlight correctly:

prism-jsx-broken
prism-jsx-correct

Most helpful comment

@Golmote I'll try it over the weekend

All 3 comments

:+1:

I was about to raise something similar for JSX and comments:

screen shot 2016-11-22 at 09 27 09

screen shot 2016-11-22 at 09 26 47

tell me if you prefer to create another issue, but there are multiple ways like this that breaks highlighting.

@vkbansal: Can you investigate this?

@Golmote I'll try it over the weekend

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nterray picture nterray  路  4Comments

benjaminBrownlee picture benjaminBrownlee  路  4Comments

TheZoker picture TheZoker  路  9Comments

donnieflorence picture donnieflorence  路  4Comments

kopax picture kopax  路  8Comments