Skip to content

[powershell] A specific regex breaks code colours #71

Closed

Description

From Luc FULLENWARTH (@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 = '[email protected]',

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

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

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

    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

Activity

  1. aeschli commented on Feb 27, 2018

    @aeschli
    Author

    David Wilson (@daviwil) Hi David, do you still want to own this issue (and other Powershell issues in the vscode repo) or should I reassign? Who would be a good replacement?

  2. aeschli commented on Feb 27, 2018

    @aeschli
    Author

    Keith Hill (@rkeithhill) Ok if I assign it to you?

  3. aeschli commented on Feb 27, 2018

    @aeschli
    Author

    From Keith Hill (@rkeithhill) on December 4, 2017 15:33

    It would be better to move this issue to https://GitHub.com/powershell/editorsyntax.

    For issues specific to the PowerShell extension, @tylerl0706 is taking over for David Wilson (@daviwil).

  4. aeschli commented on Feb 27, 2018

    @aeschli
    Author

    Fixed my switching having VSCode use the grammar from https://GitHub.com/powershell/editorsyntax.

    typicode Keith Hill (@rkeithhill) Note that we now use the powershell/editorsyntax grammar. From what I've see, that results in some coloring changes, but the changes look ok to me and it fixes some issues too.
    I'll move incoming requests/ complaints on the powershell grammar to https://GitHub.com/powershell/editorsyntax.

  5. omniomi commented on May 21, 2018

    @omniomi
    Contributor

    Fixed by #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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