Code colouring not working properly after here-string in Invoke-Command

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE 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.
User avatar
JohnMoe
Posts: 10
Joined: Sun Apr 15, 2018 11:36 pm

Code colouring not working properly after here-string in Invoke-Command

Post by JohnMoe » Tue Jul 02, 2019 5:33 pm

Product, version and build: SAPIEN PowerShell Studio 2019 Version 5.6.165
32 or 64 bit version of product: 64-bit
Operating system: Windows 10 Pro 1903
32 or 64 bit OS: 64-bit

I'm modifying some code to have a SQL query within the Invoke-Command block, and once I've done that, colouring of code after that seems to think it's still inside the string. Also, if I hover my mouse over the mis-coloured text, it tells me it's System.String, rather than cmdlet, parameter, etc. See attached screenshot for example; you can see the properly coloured code before it, and then after the here-string, it's all orange strings:
screenshot.png
screenshot.png (41.72 KiB) Viewed 1146 times
If I move the here-string to outside the Invoke-Command block, it handles it properly. Also, still within the Invoke-Command block, it suddenly starts working properly again:
screenshot2.png
screenshot2.png (73.13 KiB) Viewed 1146 times

User avatar
JohnMoe
Posts: 10
Joined: Sun Apr 15, 2018 11:36 pm

Re: Code colouring not working properly after here-string in Invoke-Command

Post by JohnMoe » Tue Jul 02, 2019 5:40 pm

....aaaaand in typical fashion, once I posted this and went back to my code, as soon as I started typing to finish the line after the here-string, the colouring immediately started working again. So not sure if that initial behaviour is a bug, or just that I hadn't finished the cmdlet? I can't seem to reproduce it again, either with or without that final variable on the -Query parameter. This can possibly just be closed then? Not sure how you want to handle it.
screenshot3.png
screenshot3.png (44.85 KiB) Viewed 1144 times

User avatar
davidc
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: Code colouring not working properly after here-string in Invoke-Command

Post by davidc » Wed Jul 03, 2019 8:01 am

It seems the tokenizer might have hiccupped while editing. When you modified the line near the end of the here string, it corrected the issue by finding the actual end of the here string.

We will keep an eye out.
David
SAPIEN Technologies, Inc.