-
Notifications
You must be signed in to change notification settings - Fork 498
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
Color coding problem when using [ValidateScript({Test-Path "${_}`:\" -PathType Container})] #225
Comments
@gravejester, do you know if your PR resolves this? |
Same problem, but with different source code : Function zero {
Write-Host "Test"
#$New."$($_.Name)"=$Old."$($_.Name)"
} #zero
Function One {
param (
$Old,
$New=$null
)
if ($New -eq $null)
{ $New=New-MyOptions }
$Old.PSObject.Properties.Match("*","Property")|
Foreach {
# The following line break the PS syntax highlighting
$New."$($_.Name)"=$Old."$($_.Name)"
}
$New
} #One
Function Two {
param (
[Parameter(Position=0, Mandatory=$True)]
[ValidateNotNullOrEmpty()]
[int] $Options
)
[void](One $Options $Script:Default)
} #Two |
Another case : function Add-ManageResources{
param (
[string] $SourceName
)
Write-Debug "Add-ManageResources $SourceName.resources"
@"
`$ResourcesPath= Join-Path `$ScriptPath "$SourceName.resources"
if ( !(Test-Path `$ResourcesPath))
{
Write-Error `"$($TransformMsgs.ManageResourcesError)`"
break;
}
$($TransformMsgs.ManageResourcesComment)
`$Reader = new-Object System.Resources.ResourceReader(`$ResourcesPath)
`$Resources=@{}
`$Reader.GetEnumerator()|% {`$Resources.(`$_.Name)=`$_.value}
$($TransformMsgs.CreateComponentComment)
"@
}#Add-ManageResources
function Add-ManagePropertiesResources {
param (
[string] $SourceName
)
Write-Debug "Add-ManagePropertiesResources $SourceName.resources"
#...
}#Add-ManagePropertiesResources |
I wonder if this feature request for VSCode would be a better long term answer for PowerShell colorization. |
A discussion has been started about adding syntax highlighting support to the language service API but I'm not sure when it'll happen. Seems like it'll happen eventually though. |
vsccode 1.4 fix these problems. |
I can confirm, my issue has been resolved. |
I use the following code to test the if the driver letter exists (sorry I can't figure out how to format it correctly due to the apostrophe):
And because of {} and ` color coding gets all out of whack in the IDE. You'll notice that most of the code afterwards is considered a string. This used to work at least 2-3 versions ago.
The text was updated successfully, but these errors were encountered: