Skip to content

Syntax coloring issue with regex #37

Closed

Description

@daviwil

From fromthewoods on February 19, 2017 5:18

I searched around and couldn't find any existing issues that address what I'm seeing, so apologies if this is already known.

I have a simple regex pattern [ValidateScript({$_ -match '^([\d\w]+\.){2,3}[\d\w]+$'})]
that vscode seems to not be able to handle and I assume it's an issue with PSEditorServices.
image

PowerShell ISE handles the same pattern properly.
image

Copied from original issue: PowerShell/PowerShellEditorServices#374

Activity

  1. daviwil commented on Feb 28, 2017

    @daviwil
    ContributorAuthor

    From fromthewoods on February 28, 2017 22:25

    Did I put this in the wrong repo? Should this be in PowerShell / vscode-powershell or Microsoft / vscode ?

  2. daviwil commented on Feb 28, 2017

    @daviwil
    ContributorAuthor
  3. fromthewoods commented on Mar 1, 2017

    @fromthewoods
  4. fromthewoods commented on Mar 1, 2017

    @fromthewoods

    Windows 7
    VScode 1.9.1
    PowerShell extension 0.9.0
    PowerShell version 5.1.14409.1005

  5. MattAllison commented on Apr 13, 2017

    @MattAllison

    I'm having the same problem. Patterns in question are:

        [Parameter(Mandatory=$True,ValueFromPipelineByPropertyName=$True )]
        [ValidatePattern("^((?!^.{90})([A-Z]{2}(-)[0-9]+-[0-9]+-[A-Z]{4}-RG-[0-9]+))$")]
        [string]$Parameter1,          
           
        [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$True)]
        [ValidatePattern("^((?!^.{80})([A-Z]{2}(-)[0-9]+-[0-9]+-[A-Z]{4}-LB-[0-9]+))$")]
        [string]$Parameter2,        
    
  6. Jawz84 commented on Jun 5, 2017

    @Jawz84

    First off; thanks for all the hard work!!
    Wanted to let you know: i have this issue too:
    [Parameter(ParameterSetName = 'Network')] [ValidatePattern('^(([2]([0-4][0-9]|[5][0-5])|[0-1]?[0-9]?[0-9])[.]){3}(([2]([0-4][0-9]|[5][0-5])|[0-1]?[0-9]?[0-9]))(\/[1-3]?[1-9])?$')] [string]$IpAddress,
    2017-06-05 1

    code -v:
    1.12.2
    19222cdc84ce72202478ba1cec5cb557b71163de
    $pseditor.EditorServicesVersion:
    1.2.1.0
    $PSVersionTable:
    Name Value
    PSVersion 5.1.15063.296
    PSEdition Desktop
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 10.0.15063.296
    CLRVersion 4.0.30319.42000
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1

  7. keller4 commented on Nov 18, 2017

    @keller4

    Wonderful project. I almost hate to bring it up, but having syntax coloring problem. Regex seems to break it, and it doesn't come back until there's a comment with a single quote in it.

    • VSCode Version: Code 1.18.1 (929bacba01ef658b873545e26034d1a8067445e9, 2017-11-16T18:32:36.023Z)
    • OS Version: Windows_NT x64 10.0.16299
    • Extensions:
      Extension|Author (truncated)|Version
      PowerShell|ms-|1.5.1

    Example:
    function test
    {
    param(
    # Using customer IDs filter
    [Parameter(Mandatory=$false,
    ParameterSetName='Search')]
    [ValidatePattern('^[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}$')]
    [string]
    $UsingCustomerIDs
    )
    # Comment with ' in it
    Get-ChildItem c:
    }
    image

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

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions