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 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.
This topic is 4 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
JohnMoe
Posts: 20
Last visit: Wed Dec 02, 2020 11:45 pm

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

Post by JohnMoe »

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 6911 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 6911 times
User avatar
JohnMoe
Posts: 20
Last visit: Wed Dec 02, 2020 11:45 pm

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

Post by JohnMoe »

....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 6909 times
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

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

Post by davidc »

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.
This topic is 4 years and 8 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.