Page 1 of 1

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

Posted: Tue Jul 02, 2019 5:33 pm
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 1959 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 1959 times

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

Posted: Tue Jul 02, 2019 5:40 pm
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 1957 times

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

Posted: Wed Jul 03, 2019 8:01 am
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.