Posts

Showing posts with the label powershell-core

Getting powershell current line before ENTER is pressed

12 1 I had an idea to write a visualizer that displays an AST of your PowerShell line as you type it. But to do this, the first step would be to get the text of the current line, before it is submitted (before ENTER is pressed), but I can't find an API function or hook to do this. Does one exist? I am using PowerShell Core 7.1.0 on the new Windows Terminal. PredictiveSource It seems like PSReadLine's PredictiveSource option might be able to be used for this, provided that it can be invoked on every letter entry and not just on TAB, but I can't find any info on the type contract for 3rd-party plugins after digging through both the docs and the the C# code... Set-PSReadLineKeyHandler As the legendary @mklement0 has suggested, perhaps Set-PSReadLineKeyHan...