SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: cb831 on October 22, 2006, 01:01:04 am

Title: Powershell escape char
Post by: cb831 on October 22, 2006, 01:01:04 am
Hi

Is there anyway I can configure VS to behave correctly on Powershell's excape char which is accent-grave (backtick).
Basically the editor should behave the same way as with \ in .c files.

Claus
Title: Re: Powershell escape char
Post by: Dan on October 24, 2006, 11:35:58 am
Do you have an extension set up for these files yet?

Is this primarily a color coding issue?

Thanks,

Dan
Title: Re: Powershell escape char
Post by: cb831 on October 24, 2006, 09:07:11 pm
Yes, I have set up a .ps1 extension refering to lexer "Powershell" defined in user.vlx

Yes, it is a color issue e.g. the below fails at the line following Get-Content line because of the line continuation `

function Get-HexDump ($path = $(throw "path must be specified"),$width=16, $total=-1)
{
    $OFS=""
    Get-Content -Encoding byte $path -ReadCount $width `
        -totalcount $total | %{
        $record = $_
        if (($record -eq 0).count -ne $width)
        {
            $hex = $record | %{
                " " + ("{0:x}" -f $_).PadLeft(2,"0")}
            $char = $record | %{
                if ([char]::IsLetterOrDigit($_))
                    { [char] $_ } else { "." }}
            "$hex $char"
        }
    }
}
Title: Re: Powershell escape char
Post by: cb831 on November 02, 2006, 05:26:06 pm
Any comments ?
Title: Re: Powershell escape char
Post by: Matthew on November 02, 2006, 07:26:10 pm
It's hard to say what the "correct" behavior should be since Powershell syntax is going to be user-defined anyway. I'd like to see how you have your lexer defined. Please post your definition from user.vlx.
I played around with this a few months ago. I'll attach the lexer I defined, wps.vlx. It's a little stale since I haven't updated it since the Monad Beta 2 days. I'm also attaching my ps1.e file, which I threw together just to get support for function, filter, and alias listings in the Defs tool window.