Skip to content

[powershell] A specific regex breaks code colours #71

@aeschli

Description

@aeschli

From @fullenw1 on October 26, 2017 15:48

  • VSCode Version: Code 1.17.2 (b813d12980308015bcd2b3a2f6efa5c810c33ba5, 2017-10-16T13:59:46.104Z)
  • OS Version: Windows_NT x64 6.1.7601
  • Extensions:
Extension Author (truncated) Version
PowerShell ms- 1.4.3
vscode-icons rob 7.16.0

(2 theme extensions excluded)

Steps to Reproduce:

  1. Paste the code below in VSCode.
  2. Look at the code. Starting line 15, code colours are wrong.

The line [validatePattern('^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$')] seems to break code colours.

function New-Foo
{
    Param(
        [Parameter(
            Mandatory,
            Position = 0,
            ValueFromPipeline,
            ValueFromPipelineByPropertyName
        )]
        [ValidateNotNullOrEmpty()]
        [System.Guid]$Id,

        [ValidateNotNullOrEmpty()]
        [validatePattern('^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$')]
        [string]$SmtpServer = 'smtp.mycompany.com',

        [ValidateNotNullOrEmpty()]
        [ValidateRange(1, 65535)]
        [int]$Port = 25,

        [ValidateNotNullOrEmpty()]
        [ValidatePattern("^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")]
        [string]$From = 'myemail@mycompany.com',

        [ValidateNotNullOrEmpty()]
        [ValidatePattern("^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")]
        [string]$To = 'myemail@mycompany.com',

        [ValidateNotNullOrEmpty()]
        [ValidatePattern("^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")]
        [string]$Cc,

        [ValidateNotNullOrEmpty()]
        [ValidatePattern("^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")]
        [string]$Bcc = 'myemail@mycompany.com'
    )

    Begin
    {
        $CultureInfo = [System.Globalization.CultureInfo]'en-US'
    }

    Process
    {
        foreach ($IdItem in $Id)
        {
            $Alert = ''
            $Alert = Get-SCOMAlert -Id $IdItem
        }
    }
}

Copied from original issue: microsoft/vscode#36991

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions