PowerShell Studio 2016 v5.2.127 x64
Windows Server 2012 R2 64bit
When using the modulus operator syntax highlighting appears messed up:
FYI, SaveColor is a valid parameter to the New-HeaderCell function and is highlighted correctly when the modulus operator is not used.
Syntax Highlighting following modulus operator
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Syntax Highlighting following modulus operator
I'm currently unable to reproduce this, could you provide me with some more information regarding your script? I typed out the exact same thing you have there and even created a faux New-HeaderCell function just to verify.
A few things that would be helpful:
A few things that would be helpful:
- Have you made any custom color settings in Options -> Editor -> Font and Color..?
- What exactly does the New-HeaderCell function do? Can you provide the function itself?
- Is this a .ps1 file or a .psf?
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Syntax Highlighting following modulus operator
Have you made any custom color settings in Options -> Editor -> Font and Color..?
Oh, indeed. Lots. Attached is my (slightly sanitized) settings xml file.
What exactly does the New-HeaderCell function do? Can you provide the function itself?
Sure. Nothing special. It returns a string of HTML.
Is this a .ps1 file or a .psf?
PS1
Oh, indeed. Lots. Attached is my (slightly sanitized) settings xml file.
What exactly does the New-HeaderCell function do? Can you provide the function itself?
Sure. Nothing special. It returns a string of HTML.
- function New-HeaderCell {
- [CmdletBinding(DefaultParameterSetName = 'SaveColor')] [OutputType([System.String])]
- Param (
- [Parameter(Mandatory, Position = 0)][string]$Text,
- [Parameter(Position = 1, ParameterSetName = 'SaveColor')][string]$Color = '#024D89',
- [int]$ColSpan = 0,
- [int]$RowSpan = 0,
- [Parameter(ParameterSetName = 'SaveColor')][Parameter(ParameterSetName = 'RandomColor')][string]$SaveColor,
- [Parameter(ParameterSetName = 'UseColor')][string]$UseColor,
- [Parameter(ParameterSetName = 'RandomColor')][switch]$RandomColor
- )
- switch ($PsCmdlet.ParameterSetName) {
- 'RandomColor' { $Color = Get-RandomColor; if ($SaveColor) { $SavedColors[$SaveColor] = $Color; break } }
- 'SaveColor' { if ($SaveColor) { $SavedColors[$SaveColor] = $Color; break } }
- 'UseColor' {
- $Color = $SavedColors[$UseColor]
- if (!$Color) { $Color = '#024D89' }
- break
- }
- }
- $Out = '<th'
- if ($ColSpan) {
- $Out += ' colspan="{0}"' -f $ColSpan
- }
- if ($RowSpan) {
- $Out += ' rowspan="{0}"' -f $RowSpan
- }
- # '{2} style="background-color:{1};color:white;text-align:center;vertical-align:bottom;">{0}</th>' -f $Text, $Color, $Out
- '{2} style="background-color:{1};">{0}</th>' -f $Text, $Color, $Out
- }
PS1
- Attachments
-
- PowerShellStudio.Settings.xml
- (25.72 KiB) Downloaded 134 times
Re: Syntax Highlighting following modulus operator
Thank you for that, I'll look into this and get back to you when I have some more information.
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Syntax Highlighting following modulus operator
Well I imported your PowerShell Studio settings, added in your New-HeaderCell function and still am not having much luck reproducing this. I say much luck because I did notice the closing bracket isn't colored properly so there's some progress.
Since you mentioned this is one ps1 is there anyway you can upload the ps1 and I can try to reproduce it with that? If you don't want the code to be public you're welcome to upload it to our support uploads section which is only accessible by us support staff: https://sapien.com/support/upload
Since you mentioned this is one ps1 is there anyway you can upload the ps1 and I can try to reproduce it with that? If you don't want the code to be public you're welcome to upload it to our support uploads section which is only accessible by us support staff: https://sapien.com/support/upload
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Syntax Highlighting following modulus operator
It may have helped if I attached the screenshot of my results
Here's what I ended up with on my end:
Here's what I ended up with on my end:
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Syntax Highlighting following modulus operator
Thanks. Yes, looking at your screenshot not only is the bracket miscolored but so is the operator itself as well as the number. Based on the color scheme and the fact it's an operator, the color of the % character should be red (it's yellow in the first instance and a brown in the second), and the 3 (at least in the first instance) is an off-white whereas it should be purple. I was able to duplicate your results in a new file.
While the original screenshot is from a PS1 file, many of the functions it uses are actually coming from a module. The New-HeaderCell function, for example, actually is part of a module. I also am having difficulties recreating the miscoloring of the SaveColor parameter name in another file, but it remains miscolored in the original file as the screenshot in the first post shows. I will upload both the PS1 file and the PSM file to the link you gave shortly.
While the original screenshot is from a PS1 file, many of the functions it uses are actually coming from a module. The New-HeaderCell function, for example, actually is part of a module. I also am having difficulties recreating the miscoloring of the SaveColor parameter name in another file, but it remains miscolored in the original file as the screenshot in the first post shows. I will upload both the PS1 file and the PSM file to the link you gave shortly.
Re: Syntax Highlighting following modulus operator
Looking at the screenshot in your first post a bit closer, you'll notice even there that the operator and the bracket are miscolored on line 5. It's a bit hard to tell without looking closely, but the operator appears to be blue and italicized, whereas it should be the same color as the other operators ("=" specifically, but it is a slightly different shade), and not italicized. (The number may be miscolored as well, but with that scheme it's hard to tell.) And the second instance of % on line 6 is white, which is not correct either according to your scheme.
Edit: looking at it closer, maybe it's not italicized after all. Not sure, but it does not look quite the same as the % in line 6 regardless.
Edit: looking at it closer, maybe it's not italicized after all. Not sure, but it does not look quite the same as the % in line 6 regardless.
Re: Syntax Highlighting following modulus operator
Thank you for the upload, I'll try and reproduce it on my end using your files and let you know.
In the meantime, I've alerted the developers to this issue and will post here if I hear anything back.
In the meantime, I've alerted the developers to this issue and will post here if I hear anything back.
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: Syntax Highlighting following modulus operator
Quick update, I've managed to reproduce this on my end successfully with the file you provided and passed this on to the developers as well.
I see what you mean about the -SaveColor parameter changing colors in the original script and yet with a new file it doesn't appear to be the off color yellow. Either way, we'll get this sorted out as soon as we can and I'll give you an update here when we've got it fixed.
I see what you mean about the -SaveColor parameter changing colors in the original script and yet with a new file it doesn't appear to be the off color yellow. Either way, we'll get this sorted out as soon as we can and I'll give you an update here when we've got it fixed.
DevinL
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.