Releases: nicoespeon/abracadabra
4.9.2-beta
Bump version (v4.9.2-beta)
4.9.2-alpha
Bump version (v4.9.2-alpha)
4.9.2
No change in the extension itself.
Abracadabra is now deployed to the Open VSX Registry, making it available for VS Code alternatives as VS Codium.
4.9.1
Fixed
- Extract Class now handles classes that implement multiple interfaces
Extract Class Hero 🐄
Added
- [New Refactoring] Extract Class, such a useful refactoring implemented by @justerest 🙏
Changed
- Extracting a member expression used to destructure it by default. But sometimes, it's not convenient. Consider the following code:
console.log(a1.length + a2.length);
If you want to extract both length
, you'll end up with such code:
const { length: a1Length } = a1;
const { length: a2Length } = a2;
console.log(a1Length + a2Length);
It's a bit verbose. Now, in such case, you'll be prompt whether you want to destructure or not. So you can easily extract variables into this:
const a1Length = a1.length;
const a2Length = a2.length;
console.log(a1Length + a2Length);
Fixed
- Some string literals couldn't be correctly extracted if they matched reserved words like
return
orclass
. This is now fixed!
Vue.js Killed The Radio Star 📻
Changed
-
"Convert to Arrow Function" now preserves comments.
-
Refactorings used to mess up with Interperter Directives (aka Shebangs). Not anymore! For example, "Convert to Arrow Function" used to turn:
#!/usr/bin/env node
function test() {}
Into this:
#!/usr/bin/env nodeconst test = () => {}
Now it works as expected:
#!/usr/bin/env node
const test = () => {};
Added
- Support for
.vue
files. You can now run automated refactorings within the<script>
tags of your single-file component ✨
I like to Move it, Move it 🇲🇬
Changed
-
"Move Statements" UX got some love with 3 great improvements:
- The editor scrolls only when it's necessary
- It doesn't move the parent node unexpectedly!
- Cursor ends up more often at the expected position
-
"Bubble up If Statement" has been renamed "Lift Up Conditional", which is the most widespread name for this refactoring
Added
- "Move Statements" now handles array elements the same way it handles object properties
- [New Refactoring] Convert to Arrow Function, thanks to @OliverJAsh 🙏
I was made for Refactorin' you baby 💋
Changed
- "Negate Expression" now generates simpler logical expressions, as you'd expect.
// If you put cursor on `!isVIP` and trigger `Negate the expression`
if (!isValid && !isSelected && !isVIP) {
}
// Before, valid but uselessly complex 🤯
if (!(!(!isValid && !isSelected) || isVIP)) {
}
// After, much better 👌
if (!(isValid || isSelected || isVIP)) {
}
- "Flip If/Else" now generates guard clauses when possible.
// If you put cursor on the if statement and trigger "Flip if/else"
function sayHello(isMorning) {
sayHi();
if (isMorning) {
sayHowAreYouDoing();
}
}
// Before, valid but uselessly complex 🤯
function sayHello(isMorning) {
sayHi();
if (!isMorning) {
} else {
sayHowAreYouDoing();
}
}
// After, much better 👌
function sayHello(isMorning) {
sayHi();
if (!isMorning) return;
sayHowAreYouDoing();
}
Added
- "Convert If/Else to Ternary" now handles more complex assignments.
- "Extract Variable" now works on default exports too.
Fixed
- "Negate Expression" stopped showing up in Quick Fixes for a while. This is now fixed!
We all extract a yellow Substring ⚓
Added
- "Extract Variable" now extracts substring if that's what you selected!
It will convert the string into a template literal accordingly. It doesn't work with multi-lines template literals yet, but it's already very convenient!
Fixed
-
"Extract Variable" now resolves the earliest common ancestor of multiple occurrences that wouldn't be in the same scope. That means there's now less cases where an extraction would be invalid!
-
Update the Quick Fixes labels to put "✨" at the end. This allows you to use your keyboard to select a Quick Fix, as it's standard OS behavior. Thanks @OliverJAsh for reporting this accessibility issue!
Let It Be 🌸
Added
- [New Refactoring] Convert let to const, thanks to @nickebbitt for this one!
- "Extract Variable" now works on thrown errors too!
Fixed
- "Remove Dead Code" was broken when dealing with conditionals without braces.
- "Flip If/Else" was broken with non-negatable operators like
instanceof
. It flips the condition correctly now! - Tabs are now preserved. Some refactorings used to replace them with spaces. No more 🤠