-
Notifications
You must be signed in to change notification settings - Fork 529
Closed
Labels
Issue-BugA bug to squash.A bug to squash.
Description
System Details
- Operating system name and version: Windows 10 Pro, version 1607, build 14393.447
- VS Code version: 1.7.2
- PowerShell extension version: 0.7.2
- Output from
$PSVersionTable:
Name Value
---- -----
PSVersion 5.1.14393.206
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.206
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Issue Description
I am experiencing a problem with syntax highlighting inside a ValidatePattern attribute on a parameter.
The highlighting seems to break if I make use of a closing round bracket ) inside the validation pattern.
In that part of the pattern, I want the URL to optionally have videos/ in it.
Here is the code from the screenshots, to save from having to type it out when reproducing:
$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
function Convert-UrlForApi {
param(
[Parameter(Mandatory=$true)]
[ValidatePattern('^http:\/\/www.giantbomb.com\/(videos\/)?[a-z0-9\-]+\/[0-9]+-')]
[ValidateScript({[Uri]::IsWellFormedUriString($($_), [UriKind]::Absolute)})]
[String]$Url
)
if ($Url -match "\/3030\-[0-9]+\/$") {
return "http://www.giantbomb.com/api/game$($Matches[0])"
} elseif ($Url -match "\/2300\-[0-9]+\/$") {
return "http://www.giantbomb.com/api/video$($Matches[0])"
} else {
return $null
}
}
Please see the screenshots below.
The function itself executes fine and works absolutely as expected and desired with the round bracket in place, so it's just the syntax highlighter getting confused about the round bracket inside the pattern string.
Attached Logs
OK without the round bracket
Not OK with the round bracket
Metadata
Metadata
Assignees
Labels
Issue-BugA bug to squash.A bug to squash.

