Skip to content

Implement Split Multiple Declarations Refactoring#241

Merged
nicoespeon merged 16 commits intonicoespeon:masterfrom
iulspop:split-multiple-declarations
Feb 4, 2021
Merged

Implement Split Multiple Declarations Refactoring#241
nicoespeon merged 16 commits intonicoespeon:masterfrom
iulspop:split-multiple-declarations

Conversation

@iulspop
Copy link
Contributor

@iulspop iulspop commented Feb 2, 2021

Closes #130

Implemented the split multiple declarations refactoring.
Type annotations are preserved correctly for Typescript.

split-multiple-declarations

I'm not sure if the additions to the package.json are correct

@iulspop
Copy link
Contributor Author

iulspop commented Feb 2, 2021

Is there anything else I should add to the pull request description?

@nicoespeon
Copy link
Owner

@iulspop it's perfect! Thank you for the PR, I'll review it this week 👍

Copy link
Owner

@nicoespeon nicoespeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks great. Thanks for adding the docs and all these tests 👍


> 💡 Available as Quick Fix (`Alt ↵`)

Splits multiple variables declarated together onto a single line each.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Very great, thanks for adding docs too

},
{
"command": "abracadabra.splitMultipleDeclarations",
"when": "editorLangId == vue"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good. I agree that this part is a bit tricky and requires a lot of boilerplate. We'll eventually automate this so it's less error-prone.

import removeRedundantElse from "./refactorings/remove-redundant-else";
import renameSymbol from "./refactorings/rename-symbol";
import replaceBinaryWithAssignment from "./refactorings/replace-binary-with-assignment";
import simplifyTernary from "./refactorings/simplify-ternary";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for re-ordering this one

"typescript multiple declarations split conserves type annotations",
code: `let firstName: string = 'John', age: number = 7`,
expected: `let firstName: string = 'John';
let age: number = 7;`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Perfect, you covered a lot of cases here!

@nicoespeon
Copy link
Owner

@allcontributors please add iulspop for code, doc

@allcontributors
Copy link
Contributor

@nicoespeon

I've put up a pull request to add @iulspop! 🎉

@nicoespeon nicoespeon merged commit 9ff96c1 into nicoespeon:master Feb 4, 2021
@iulspop iulspop deleted the split-multiple-declarations branch February 4, 2021 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split into multiple declarations

2 participants