-
Notifications
You must be signed in to change notification settings - Fork 505
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
Alias expansion should move cursor to end of command name #5136
Comments
Huh, yeah, you're right. That would be a bug in the
But I'll note that the server side is in need of some TLC too: Marking this as up for grabs as it seems like a great intro bug fix that could be contributed. Thanks for the report! |
Agreed, if anyone wants to be brave, I volunteer to help get you started :) |
Hi, I've never worked on a VSCode extension, but thought I'd give it a try. However it looks like the command works differently from what I initially thought. I assumed that when there's no selection, it only expands the alias under the cursor. But it actually assumes you want to format the entire file. If that's the intended behavior, then it may not be a bug. Although personally, I'd prefer if it expanded the command at the cursor, so you could use it as you typed. |
I can confirm alt-shift-e expands all aliases and not just the highlighted one, that's not desired behavior and we should fix that for sure, please file a separate issue or I'll create one if I have time (I never use that command so I didn't notice) If you want aliases expanded in general, I recommend the following settings:
This way you can write in shorthand but all aliases will be expanded upon saving the file. It's generally not best to mix aliases and full line in the same file, I generally recommend writing shorthand and saving longhand, which these two steps automate. |
Agreed, that's a bug. It should expand just the single alias at point. Yay bugs. |
Chatted with @SydneyhSmith, if we do fix "expand alias" to just correctly expand the alias at point, we will probably still want something akin to "expand aliases" to expand all in the document. |
Super duper funny thing: she brought up the "fix problem" from PSScriptAnalyzer...and sure enough if you use |
Prerequisites
Summary
After typing an alias, if you press
Alt + Shift + E
to replace it with the full command name, the cursor remains at the original position. It should be moved to the end of the command so you can continue typing.For example (| denotes the cursor):
cd|
> Press expansion shortcut >Se|t-Location
I cannot think of a use case where leaving the cursor in the middle of the command name would be desirable. In fact, inserting a space after the command name (if there isn't already) may be desirable too.
PowerShell Version
Visual Studio Code Version
1.96.4
Extension Version
[email protected]
Steps to Reproduce
| denotes the cursor:
cd|
> Press alias expansion shortcutAlt + Shift + E
>Se|t-Location
Expected:
Set-Location|
Perhaps also insert space after command name, if there isn't one already
Visuals
No response
Logs
No response
The text was updated successfully, but these errors were encountered: