Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Inline usage(s) #22

Open
maricn opened this issue Aug 9, 2019 · 1 comment
Open

Feature Request: Inline usage(s) #22

maricn opened this issue Aug 9, 2019 · 1 comment

Comments

@maricn
Copy link

maricn commented Aug 9, 2019

I find inline refactoring very useful (coming from IntelliJ world: https://www.jetbrains.com/help/idea/inline.html).

before:

method() {
    const number = anotherClass.intValue();
    const b = a + number;
}

after:

method() {
    const b = a + anotherClass.intValue();
}

could be done with objects, statements and functions.

@xsburg
Copy link
Owner

xsburg commented Aug 10, 2019

Hi @maricn,

That's a good idea for a refactoring!

I need however to do some additional research to see what would be the best place to implement this feature.

This refactoring requires to have the information about variables in the current scope and also locate all the usages in order to inline them. Right now what we operate with is just a bare syntax tree (that's enough for most code fixes).

On the other hand, the TypeScript compiler team has a way to provide JavaScript (not only TypeScript) refactorings using the TypeScript services. It might be worth investigating for this feature because they have way more information about the code since they have the compiler at their disposal.

I will do the research and find a better way to go forward.

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants