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

Too Agressive Add {...} to arrow function #30

Closed hediet closed 2 years ago

hediet commented 2 years ago

image

lgrammel commented 2 years ago

Thanks for the bug report!

I'm trying to understand what the bug is here. Add to arrow function should be available, as it seems to be a legit code action, and it does not seem to be suggested.

Are you looking for a better activation range in the text? Or is it about the action showing up as a quick-fix?

hediet commented 2 years ago

The cursor is in the nested expression, thus I would not expect this code action.

In other cases, this code action hides a quick fix.

Maybe it makes sense to only offer this code action on the arrow.

lgrammel commented 2 years ago

That makes total sense. I'm thinking about having 2 levels of activation:

Would this option work for you?

hediet commented 2 years ago

That'd be great!

lgrammel commented 2 years ago

I've tweaked the activation ranges for 'add/remove {}' in v1.120.2. Thanks for the feedback!