Skip to content

PowerShell: Expand Alias command doesn't work on macOS #1185

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

Closed
TylerLeonhardt opened this issue Feb 2, 2018 · 0 comments
Closed

PowerShell: Expand Alias command doesn't work on macOS #1185

TylerLeonhardt opened this issue Feb 2, 2018 · 0 comments

Comments

@TylerLeonhardt
Copy link
Member

Issue Description

PowerShell: Expand Alias command doesn't work on macOS. The Integrated Console reacts to the command by showing a new prompt.

Attached are the logs.

This looks to be the important bit:

2/2/18 9:15:57 AM [VERBOSE] - Method "ExecuteCommand" at line 491 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Attempting to execute command(s):
    
    
    function __Expand-Alias {
    
        param($targetScript)
    
        [ref]$errors=$null
    
        $tokens = [System.Management.Automation.PsParser]::Tokenize($targetScript, $errors).Where({$_.type -eq 'command'}) |
                        Sort Start -Descending
    
        foreach ($token in  $tokens) {
            $definition=(Get-Command ('`'+$token.Content) -CommandType Alias -ErrorAction SilentlyContinue).Definition
    
            if($definition) {
                $lhs=$targetScript.Substring(0, $token.Start)
                $rhs=$targetScript.Substring($token.Start + $token.Length)
    
                $targetScript=$lhs + $definition + $rhs
           }
        }
    
        $targetScript
    }
    

2/2/18 9:15:57 AM [VERBOSE] - Method "OnSessionStateChanged" at line 1138 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Session state changed --
    
        Old state: Ready
        New state: Running
        Result: NotFinished

2/2/18 9:15:57 AM [VERBOSE] - Method "OnSessionStateChanged" at line 1138 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Session state changed --
    
        Old state: Running
        New state: Ready
        Result: Completed

2/2/18 9:15:57 AM [ERROR] - Method "ExecuteCommand" at line 545 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Execution completed with errors:
    
    The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    The term 'Sort' is not recognized as the name of a cmdlet, function, script file, or operable program.
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Just not sure why that error would get thrown.

Attached Logs

logs.zip

Environment Information

Visual Studio Code

Name Version
Operating System Darwin x64 16.7.0
VSCode 1.20.0-insider
PowerShell Extension Version 1.5.1

PowerShell Information

Name Value
PSVersion 6.0.0-rc.2
PSEdition Core
GitCommitId v6.0.0-rc.2
OS Darwin 16.7.0 Darwin Kernel Version 16.7.0: Thu Jan 11 22:59:40 PST 2018, root:xnu-3789.73.8~1/RELEASE_X86_64
Platform Unix
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.0.0-rc.2
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand)
Extension Author Version
beautify HookyQR 1.3.0
code-settings-sync Shan 2.8.7
color-highlight naumovs 2.3.0
csharp ms-vscode 1.13.1
docthis joelday 0.6.0
ExtensionUpdateCheck HookyQR 0.0.2
ftp-simple humy2833 0.5.8
hipsum third774 1.0.7
indent-rainbow oderwat 0.7.2
indent4to2 Compulim 0.1.2
path-intellisense christian-kohler 1.4.2
PowerShell ms-vscode 1.5.1
puppypopup StineTheBean 0.0.2
slack sozercan 0.0.14
Theme-azure gerane 0.0.2
Theme-BetterJS gerane 0.0.3
theme-monokai-dark-soda AdamCaviness 0.0.5
theme-monoko smdl 0.0.1
theme-railgun be5invis 2.3.0
theme-toothpaste aalaap 0.0.1
Theme-Zenburn gerane 0.0.3
trailing-spaces shardulm94 0.2.11
tslint eg2 1.0.24
vscode-dash deerawan 1.8.0
vscode-docker PeterJausovec 0.0.23
vscode-file-peek abierbaum 1.0.1
vscode-icons robertohuertasm 7.19.0
vscode-markdownlint DavidAnson 0.13.0
vscode-npm-script eg2 0.3.3
vscode-svgviewer cssho 1.4.3
word-count hypnoes 0.1.1
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

1 participant