views:

210

answers:

2

I have heard that the PowerShell ISE uses the same WPF text editor as VisualStudio 2010 and the Oslo IntelliPad. I know that you can extend this editor in VisualStudio by inserting your own WPF control into the editor's XAML file. My question now: Is this also possible with the PowerShellISE? Did anybody try to do this yet?

+3  A: 

It is true that it is the same control. I do not believe you can insert your own WPF control. However, the ISE is completely programatic and has an object model that you can use to customize the ISE. You can access the object model with the $psise variable. You can tweak a lot of options with $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
Andy Schneider
I haven't seen the .xaml file they are using, so I think Andy is correct that the only extension point is through the $psise object. I think the .xaml file has been compiled into one of the assemblies.
Steven Murawski
The visual studio editor is not a .xaml file :)
Noah Richards
Andy's overall point is correct - it's the same editor, but the extensibility mechanism (I think it is still MEF, but the version they have is a bit out-of-date) has essentially been set up to not load other assemblies.
Noah Richards
A: 

Yes, it is possible. Take a look on http://powershelltools.com/images/se/

PowerShellTools