Author Topic: Powershell string coloring problem  (Read 700 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Powershell string coloring problem
« on: May 19, 2022, 09:57:54 PM »
Quick summary...
Bug#1: Slick doesn't allow "$()" coloring to span lines
Bug#2: Even when I adjust it so it does, in the large file it doesn't always get it right.

Long description...
Using this file that you probably already have: %userprofile%\Documents\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1
(Could also be in %programfiles%).

Inside a string, "$( expression )" can span multiple lines, but the default coloring profile in Slick is set to color to end of line.
So, I copied the coloring profile and changed all of the string token rules to "color to end across multiple lines"

This *mostly* fixes the problem.
See the attached screen shot (PowershellStringsColors.jpg).
On the left is default (incorrect) string coloring. On the right, is with my modified coloring so that $() spans lines.

The problem is that in the larger file, the coloring for line 19 is not fixed. I don't know what is going wrong with it.
This is shown in the 2nd screen shot (PowershellStringsColors2.jpg).
In PSModule.PSM1, line 708 (corresponds to line 19 in the sample) should not color the "})" as a string, but it does.

See also a comparison with VSCode (PowershellStringsColorsVSCode.jpg) showing the problem with line 708


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6864
  • Hero Points: 528
Re: Powershell string coloring problem
« Reply #1 on: May 20, 2022, 07:39:30 PM »
Thanks for the detailed sample file!

Hot fix added for this