Releases: nicoespeon/abracadabra
Extract De Vil 🐶
Fixed
- Extract Interface now preserves generic parameter declaration, thanks to @automatensalat who reported and fixed the bug!
Changed
-
Extract Variable can be executed from the
return
keyword. It will extract the returned value just as if the cursor was on the value already. It also makes it more flexible, so extraction will work even if you have the return statement semicolon in your selection. Thanks, @automatensalat for suggesting this one! -
Extract Variable can also be executed on JSX Attributes that are string literals. A partial selection will convert the string into a template literal and extract the selected text only.
-
Destructure Object now handles spread elements and spread JSX attributes automatically.
Added
6.7.1
No change but fixed the declared VS Code engine version so we can deploy again.
Extract Like Me 🧞
Fixed
- Extract on the left-side of an
as
expression will now extract the variable, not the type. - Extract Interface now works on exported class declarations too! Thanks @automatensalat for raising it 🙏
Changed
- Convert Ternary to If/Else now works on any ternary, not just the ones that have a
return
or variable assignment inside. - Move Statements now work on JSX Elements too! There will probably be edge-cases to iron out over time, but it's good to know that you can swap 2 JSX statements with a single shortcut ⚡
- Negate Expression name was misleading. It was renamed into Invert Boolean Logic as per @forivall's recommendation 🙏
- Extract Variable now declares the variable before the leading comments of the parent node.
What's This? 🎃
Fixed
- Fix a scenario where Extract Type would produce invalid code if there were commas in the extracted type.
- Fix some scenarios where Extract Variable would put the cursor in a wrong place which prevented the automatic rename.
Added
- [New Refactoring] Convert ForEach to For-Of, thanks to @ianobermiller for this one 🎉
6.5.2
Fixed
- Destructure Object is not performant. That's an issue on large projects as it's exposed as a Quick Fix (lightbulb). To prevent blocking your editor, we have disabled the Quick Fix for this refactoring.
You can still execute this refactoring using VS Code's Command Palette.
We'll put it back as a quick fix once the performance issue is solved. See #415 for details.
6.5.1
A little fix to get the release deployed to the marketplaces.
A Dream Is a Wish Your Heart Makes 🐭
Fixed
- Flip If/Else now uses
continue
instead ofreturn
in loops, so your code doesn't break. Thanks to @j4k0xb for spotting this one!
Changed
- Extract Type can now extract TS type queries. That means you can extract some
typeof myVariable
into a type alias. - Extract Type can also extract union and intersection types from anywhere now!
- Toggle Braces now works on all kind of loops (for, for-in, for-of, while, do-while). Thanks to @chrstnbrn for implementing these 👏
Added
- [New Refactoring] You can now destructure an object automatically! Put your cursor on any occurrence of the identifier to trigger the refactoring. It works if the shape of the object can be inferred, so that works best with TypeScript code (e.g.
interface
and object-like types).
Friends on the Other Side 🐸
Fixed
- Finally got "Move to existing file" work on Windows OS, thanks to @sumbatx15
- Merge If Statements used to appear on patterns it couldn't execute on. Not anymore!
Changed
- Extract Type now works on Type Parameters too (e.g.
number
indoSomething<number>()
can now be extracted).
Added
- [New Refactoring] Add separators to numeric literals. It's a not well-known syntax that makes magic numbers easier to read. You can now turn
100000
into10_000
in a snap 👌
6.3.1
Fixed
- Another attempt at making "Move to existing file" work on Windows OS.
- Abracadabra now preserves tabs when you use "Rename Symbol" in a
.vue
file. No more converting the indentation to spaces 😁 - Following up with "Rename Symbol" in Vue files, Abracadabra will now explicitly tell you when it can't rename the identifiers that are used in templates, for instance.
That is a great opportunity for a reminder!
While refactorings can be executed in .vue
files, please keep in mind that the scope is limited to the <script>
tag. This is more like a workaround for Vue developers until an extension like Vetur implements these 🙂
Ev'rybody Wants to Be a File 😺
Fixed
- Make "Move to existing file" work on Windows OS.
Changed
- Extract Type now works on TS
as
expressions too! - Remove Redundant Else now supports if statements that have no braces. That scenario can typically result from another refactoring. Being able to chain refactorings is nice, isn't it?
- Merge if-statements can now consolidate
if/else-if
that have the same body.