-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No completion for Properties of $Error[n] #16941
Comments
If you unload PSReadline and try tab completing or invoke TabExpansion2 manually you get the expected results. I think the issue is that PowerShell looks at the current scope, and I guess $error exists but is empty in the PSReadline module scope. |
See #3568 for no success history. |
He said:
If that's true then I don't see how this can be fixed without some sort of hack, PowerShell is correctly finding the $Error variable in the PSReadline scope. |
If I understand correctly current status is that the issue presents only if PSReadline is loaded. If so maybe @daxian-dbw advice. |
Interactive completion of |
As @MartinGC94 pointed out this is due to PSReadLine's entry point having affinity to its module's session state. The easiest fixes would be in PSReadLine itself to do one of these:
As a workaround, you can put this in your profile: . (Get-Module PSReadLine) {
$function:PSConsoleHostReadLine = $function:PSConsoleHostReadLine.Ast.Body.GetScriptBlock()
}
$function:PSConsoleHostReadLine = $function:PSConsoleHostReadLine.Ast.Body.GetScriptBlock() (Both seem to be needed when export has already occurred. Not really sure why. Also note that the addition of |
The above fix could work, but there is also possibility that the So, maybe the fix needs to happen in the tab completion code, for example, |
This issue has not had any activity in 6 months, if there is no further activity in 7 days, the issue will be closed automatically. Activity in this case refers only to comments on the issue. If the issue is closed and you are the author, you can re-open the issue using the button below. Please add more information to be considered during retriage. If you are not the author but the issue is impacting you after it has been closed, please submit a new issue with updated details and a link to this issue and the original. |
Prerequisites
Exception report
N/A
Screenshot
Environment data
Steps to reproduce
Expected behavior
Powershell should return completions of
System.Management.Automation.ErrorRecord
Actual behavior
Powershell apparently returns completions of
Array
instead ofErrorRecord
.The text was updated successfully, but these errors were encountered: