Skip to content

Auto expansion for alias commands. #496

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

Open
ww40 opened this issue Feb 9, 2017 · 21 comments
Open

Auto expansion for alias commands. #496

ww40 opened this issue Feb 9, 2017 · 21 comments
Labels
Issue-Enhancement A feature request (enhancement).

Comments

@ww40
Copy link

ww40 commented Feb 9, 2017

A common factor in providing help and reviewing PowerShell scripts in general we find veterans who will use alias's for common commands such as %(ForEach-Object), cls(Clear-Host), ri(Remove-Item), mi(Move-Item, CD(Set-Location)....I'm sure you see where i'm going with this.

What if upon saving your solution there would be an option to automatically convert all the alias commands into their full commands to save time on converting documents into more readable documents for future use/reviews.

Could this be something you could implement?

@daviwil
Copy link
Contributor

daviwil commented Feb 9, 2017

We could definitely enable "expand aliases on save" and put it behind a setting so that it can be turned on per-workspace.

@daviwil daviwil added the Issue-Enhancement A feature request (enhancement). label Feb 9, 2017
@daviwil daviwil added this to the Backlog milestone Feb 9, 2017
@daviwil
Copy link
Contributor

daviwil commented Feb 9, 2017

@kapilmb wanna give this a shot for 0.11.0?

@kapilmb
Copy link

kapilmb commented Feb 9, 2017

This looks like a special case of #417. Sure, we can get target it for 0.11.0.

@rkeithhill
Copy link
Contributor

Please do not enable it by default. I think this needs to be "opt-in".

@daviwil
Copy link
Contributor

daviwil commented Feb 9, 2017

Yeah, enabling by default would not be the desired behavior.

@eweilnau
Copy link

eweilnau commented Feb 9, 2017

It might be nice to allow configuration to include or exclude aliases from this expansion. I know several people in the community who are against expanding *-object aliases (i.e. select, where)

@daviwil
Copy link
Contributor

daviwil commented Feb 9, 2017

@daviwil
Copy link
Contributor

daviwil commented Feb 9, 2017

Might be worth having a blacklist too, though. A whitelist will be harder to maintain.

@rkeithhill
Copy link
Contributor

several people in the community who are against expanding *-object aliases

I was one of those folks until PowerShell went cross platform where sort is a native util and PowerShell Core does not provide sort as an alias to Sort-Object. Now I'm firmly in the camp of expanding *-Object.

@eweilnau
Copy link

eweilnau commented Feb 9, 2017

I see this as part of (or at least similar to) formatting in which more configuration is better because consensus is (nearly) impossible.

@Jaykul
Copy link

Jaykul commented Feb 13, 2017

I just wish tab-expansion would offer to change cd to Set-Location...

@daviwil
Copy link
Contributor

daviwil commented Feb 13, 2017

@Jaykul: what would be the desired flow for that? You type cd and you get Set-Location as a completion option? Or you type cd and hit tab and it turns into Set-Location?

@jagrock
Copy link

jagrock commented May 10, 2017

For me, the completion option by default and a setting to enable the tab turns into on/off.

@pcgeek86
Copy link
Contributor

I would make the original request into something more broad, where you run an entire set of customizable PSScriptAnalyzer rules against the entire VSCode workspace, triggered by certain events (eg. Files: Save All). The PowerShell extension could have a configurable setting to point to the path of an array of PSScriptAnalyzer rule manifests, relative to the workspace path.

@RickFlist
Copy link

Hi all,

Has this been released? If not is there a date?

@daviwil
Copy link
Contributor

daviwil commented Sep 1, 2017

@RickFlist try the "PowerShell: Expand Alias" command, that should work for now.

@RickFlist
Copy link

That's what I'm using now. Thanks

@TylerLeonhardt
Copy link
Member

Doing some issue clean up. How are we feeling about this? Are we at a point where we can close it? The "PowerShell: Expand Alias" command works really well.

Or are we interested in an opt-in feature to turn on expanding aliases on save?

@pcgeek86
Copy link
Contributor

pcgeek86 commented Dec 8, 2017

@tylerl0706 bigger fish to fry at the moment. I'd say close it.

@nlupica1
Copy link

nlupica1 commented May 4, 2018

Some people want this feature. Just set it to false by default, but give people the option to enable it. We already have "editor.formatOnSave"-- why not add "editor.expandAliasOnSave"?

@TylerLeonhardt TylerLeonhardt modified the milestone: Future May 24, 2018
@SydneyhSmith SydneyhSmith removed this from the Future milestone Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

14 participants