borela / naomi

Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Other
558 stars 18 forks source link

punctuation.accessor.optional-chain scope incorrect after accessing path with square brackets #207

Open MauricioAndrades opened 5 years ago

MauricioAndrades commented 5 years ago

I hate asking for these updates (Wish I knew how to do this myself so I could contribute) but would it be possible to update this?

Screenshot shows the scope that get's set incorrectly.

 if (typeof onFocus === "function") {
        onFocus(event);
 }

the scope of the if statement is source.js meta.declaration.variable.js.fjsx15 meta.function.js.fjsx15 meta.block.js.fjsx15 meta.conditional.js.fjsx15 meta.group.js.fjsx15 meta.object-literal.js.fjsx15 meta.block.js.fjsx15 meta.function-call.js.fjsx15 variable.function.js.fjsx15

without optional chain bracket acces it's source.js meta.declaration.variable.js.fjsx15 meta.function.js.fjsx15 meta.block.js.fjsx15 meta.conditional.js.fjsx15 keyword.control.conditional.js.fjsx15

const handleFocus = (event) => {
    const {validation, validationKey, onFocus} = this.props;
    if (validation?.fields?.[validationKey]) {
        validation.fields[validationKey].hasBeenFocused = true;
    }
    if (typeof onFocus === "function") {
        onFocus(event);
    }
};

image

borela commented 5 years ago

Fixed in https://github.com/borela/naomi/releases/tag/v4.2.11

MauricioAndrades commented 5 years ago

You're the best. Thank you 👍