Tabexpansion function Does Not Resolve Variable
Posted
by chadwickmiller
on Stack Overflow
See other posts from Stack Overflow
or by chadwickmiller
Published on 2010-04-15T11:45:02Z
Indexed on
2010/04/19
0:53 UTC
Read the original article
Hit count: 347
powershell
|powershell-ise
I'm attempting to override and implement my own TabExpansion. In the function I want to parse the contents of $psise.CurrentFile.Editor.Text when a certain $lastword criteria is matched. The issue I have is that the variable $psise.CurrentFile.Editor.Text is resolved to the contents of my TabExpansion function rather than whatever text is in a PowerShell ISE tab.
Here's simple test function. Open an ISE tab and paste the following tabexpansion function definition:
function tabexpansion
{ $psise.CurrentFile.Editor.Text }
Run the script in ISE. Next open another tab in ISE type some text and press the tab key The output will be
function tabexpansion
{ $psise.CurrentFile.Editor.Text }
Rather than whatever text was in the second tab. Is there any way to get $psise.CurrentFile.Editor.Text to resolve at runtime when used within a tabexpansion function?
© Stack Overflow or respective owner