p42ai / js-assistant

120+ refactorings and code-assists for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=p42ai.refactor
MIT License
119 stars 7 forks source link

Convert if-else to conditional expression does not works with this.var #7

Closed chandan192 closed 2 years ago

chandan192 commented 2 years ago

let x; if (me.isEnabledColumnFilter === true) { x = 'Disable Filters'; } else { x = 'Enable Filters'; }

Here, refactoring works perfectly and yield result is

let x; x = me.isEnabledColumnFilter === true ? 'Disable Filters' : 'Enable Filters';

But, the linting is not shown with this keyword. Below is the code.

if (this.isEnabledColumnFilter === true) { this.filterTitle = 'Disable Filters'; } else { this.filterTitle = 'Enable Filters'; }

lgrammel commented 2 years ago

Thanks for the suggestion!

I will see if I can integrate it in one of the next releases.

lgrammel commented 2 years ago

The feature is implemented and will be included in the next release.

lgrammel commented 2 years ago

@chandan192 I've just released version 1.57.0, which supports your suggested improvement. Please re-open if you still cannot run the refactoring on version 1.57.0 or higher. Thanks for the suggestion!

chandan192 commented 2 years ago

Hi @lgrammel, converting if-else to conditional expression is not working for the below case.

image

lgrammel commented 2 years ago

Hi @chandan192 - thanks for the bug report. I'll look into it.

lgrammel commented 2 years ago

Fixed in 1.64.2 - thanks for the bug report!