zigford.org

About | Links | Scripts
Sharing linux/windows scripts and tips

Powershell syntax now supported by ALE (Vim) plugin

April 15, 2019 — Jesse Harris

ALE project has approved my PR to show powershell syntax errors by parsing the powershell by powershell itself. If the current buffer has a filetype of Powershell, the buffer is run through the following powershell script to check for syntax errors. Errors are then displayed in Vim by ALE:


        Param($Script)
        trap {$_; continue } & {
            $Contents = Get-Content -Path $Script;
            $Contents = [string]::Join([Environment]::NewLine, $Contents);
            [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents);
        };

Tags: ale, vim, powershell