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

Inline local refactoring #18459

Closed
mjbvz opened this issue Sep 14, 2017 · 7 comments · Fixed by #54281
Closed

Inline local refactoring #18459

mjbvz opened this issue Sep 14, 2017 · 7 comments · Fixed by #54281
Assignees
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Fix Available A PR has been opened for this issue In Discussion Not yet reached consensus Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Sep 14, 2017

Proposal
Add a refactoring to inline a local variable. Example:

function generatePipeName(): string {
	const hexString = makeRandomHexString(40);
	return getPipeName(hexString);
}

The Inline local refactoring on hexString would result in:

function generatePipeName(): string {
	return getPipeName(makeRandomHexString(40));
}
@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Sep 14, 2017
@DanielRosenwasser DanielRosenwasser added Domain: Refactorings e.g. extract to constant or function, rename symbol Suggestion An idea for TypeScript labels Sep 14, 2017
@RyanCavanaugh RyanCavanaugh added the Experience Enhancement Noncontroversial enhancements label Aug 22, 2018
@ghost ghost mentioned this issue Sep 13, 2018
4 tasks
@weswigham weswigham added the In Discussion Not yet reached consensus label Nov 6, 2018
@D0nGiovanni
Copy link
Contributor

I've been working on this issue for a while now, but I'm not too familiar with the compiler API. Is there a way to dynamically generate a new node based on the SyntaxKind of another? I'm concerned that if I just make a copy, the id will stay the same and that would lead to problems down the road.

@D0nGiovanni
Copy link
Contributor

D0nGiovanni commented Nov 8, 2018

@weswigham What is the label in discussion for? Is it being discussed whether to implement the issue at all, or is there a different meaning? I would like to implement it in the near future (1-2 weeks).

@weswigham
Copy link
Member

Ah, just means we're considering it for inclusion. Everything that's labeled as a "Suggestion" is supposed to have one of a set of sublabels indicative of the issue's state. I felt that was probably most correct here (it's not "committed" because we've not allocated anyone to work on it).

@jackric
Copy link

jackric commented Jul 7, 2020

Anyone suggest a VSCode extension that does this in lieu of waiting for official support?

@OliverJAsh
Copy link
Contributor

Anyone suggest a VSCode extension that does this in lieu of waiting for official support?

https://github.com/nicoespeon/abracadabra#inline-variable

@olfek
Copy link

olfek commented Mar 19, 2023

2023

@tylerlaprade
Copy link

Thanks @MariaSolOs for the fix! Will the documentation be updated to match?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Refactorings e.g. extract to constant or function, rename symbol Fix Available A PR has been opened for this issue In Discussion Not yet reached consensus Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.