我听说PowerShell ISE使用与VisualStudio 2010和Oslo IntelliPad相同的WPF文本编辑器。我知道您可以通过将自己的WPF控件插入编辑器的XAML文件中来扩展VisualStudio中的此编辑器。我现在的问题:PowerShellISE也可以吗?有人试过这样做吗?

有帮助吗?

解决方案

确实它是相同的控制。我不相信你可以插入自己的WPF控件。但是,ISE是完全编程的,并且具有可用于自定义ISE的对象模型。您可以使用$ psise变量访问对象模型。您可以使用$ psise.options调整很多选项

1 >  $psise.options


SelectedScriptPaneState       : Right
ShowToolBar                   : True
TokenColors                   : {[Attribute, #FF84A7C1], [Command, #FFFFFF60], 
                                [CommandArgument, #FFFFFFFF], [CommandParameter
                                , #FFFFDE00]...}
DefaultOptions                : Microsoft.PowerShell.Host.ISE.ISEOptions
FontSize                      : 16
FontName                      : consolas
ErrorForegroundColor          : #FFFF0000
ErrorBackgroundColor          : #00FFFFFF
WarningForegroundColor        : #FFFF8C00
WarningBackgroundColor        : #00FFFFFF
VerboseForegroundColor        : #FF0000FF
VerboseBackgroundColor        : #00FFFFFF
DebugForegroundColor          : #FF0000FF
DebugBackgroundColor          : #00FFFFFF
OutputPaneBackgroundColor     : #FF000000
OutputPaneTextBackgroundColor : #FF000000
OutputPaneForegroundColor     : #FFFFFFFF
CommandPaneBackgroundColor    : #FF000000
ScriptPaneBackgroundColor     : #FF000000
ScriptPaneForegroundColor     : #FF000000
ShowWarningForDuplicateFiles  : True
ShowWarningBeforeSavingOnRun  : True
UseLocalHelp                  : True
CommandPaneUp                 : True
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top