Skip to content

[powershell] A specific regex breaks code colours #36991

Closed

Description

  • VSCode Version: Code 1.17.2 (b813d12, 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
        }
    }
}

Activity

  1. added
    grammar
    on Oct 26, 2017
  2. aeschli commented on Nov 14, 2017

    @aeschli
    Contributor

    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?

  3. changed the title [-]A specific regex breaks code colours[/-] [+][posershell] A specific regex breaks code colours[/+] on Nov 17, 2017
  4. changed the title [-][posershell] A specific regex breaks code colours[/-] [+][powershell] A specific regex breaks code colours[/+] on Nov 17, 2017
  5. aeschli commented on Dec 4, 2017

    @aeschli
    Contributor

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

  6. rkeithhill commented on Dec 4, 2017

    @rkeithhill

    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).

  7. aeschli commented on Feb 9, 2018

    @aeschli
    Contributor

    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.

  8. added
    upstream
    on Feb 27, 2018
  9. aeschli commented on Feb 27, 2018

    @aeschli
    Contributor

    This issue was moved to PowerShell/EditorSyntax#71

  10. locked and limited conversation to collaborators on Mar 26, 2018
  11. added a commit that references this issue on Sep 6, 2026
    826bf2a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

grammarlanguages-basicupstream

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions