Page 1 of 1
Code completion doesn't work as expected
Posted: Wed Jul 29, 2020 3:50 am
If I use the following simple demo code:
[xml]$xml = Get-Content 'inventory.xml'
foreach ($node in $xml.DocumentElement.Childnodes)
$myjuhu = $xml.CreateElement('juhu')
$myjuhu.innerText = 'juhu'
I have no chance to get any help if I type $node.
If I do the same with the standard ISE, after the first run ISE knows the type of $node and it will offer me methods for $node.
So what do I have to do, to get at least the same help from Powershell Studio?
Re: Code completion doesn't work as expected
Posted: Wed Aug 05, 2020 7:27 am
This is because it does not know what the type of $node is, therefore the editor does not know what information to provide via intellisense. As you casted the the result of Get-Content to xml, it was then recognized as xml and intellisense information was able to be provided. PowerShell Studio doesn't store information about the script after its run.
You may find the following helpful: