Skip to content

Syntax coloring issue with regex #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
daviwil opened this issue Feb 28, 2017 · 8 comments
Closed

Syntax coloring issue with regex #37

daviwil opened this issue Feb 28, 2017 · 8 comments
Assignees
Labels
Milestone

Comments

@daviwil
Copy link
Contributor

daviwil commented Feb 28, 2017

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

@daviwil
Copy link
Contributor Author

daviwil commented Feb 28, 2017

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 ?

@daviwil
Copy link
Contributor Author

daviwil commented Feb 28, 2017

From @rkeithhill on February 28, 2017 22:26

It should go in https://github.com/powershell/editorsyntax.

@fromthewoods
Copy link

Thanks @daviwil and @rkeithhill.

@fromthewoods
Copy link

Windows 7
VScode 1.9.1
PowerShell extension 0.9.0
PowerShell version 5.1.14409.1005

@MattAllison
Copy link

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,        

@Jawz84
Copy link

Jawz84 commented Jun 5, 2017

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

@gravejester gravejester added the bug label Sep 4, 2017
@gravejester gravejester added this to the v2 milestone Sep 4, 2017
@gravejester gravejester self-assigned this Sep 4, 2017
@keller4
Copy link

keller4 commented Nov 18, 2017

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

@omniomi omniomi mentioned this issue May 10, 2018
@omniomi
Copy link
Contributor

omniomi commented May 21, 2018

Fixed by #94

@omniomi omniomi closed this as completed May 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants