Skip to content

Feature Request: Call VSCode commands from $psEditor variable #804

Open
@pcgeek86

Description

@pcgeek86

It would be really cool if a PowerShell script were able to invoke VSCode commands, effectively automating the IDE from PowerShell. This could be exposed via the built-in $psEditor variable that's accessible in the VSCode-PowerShell environment.

Related to #773, but more broad.

If there's already a way to do this, I'd love to hear it. I've explored the Workspace and Window variables on the $psEditor object, along with the GetEditorContext() method output, and can't find any way to do this right now.

PS /Users/tsulli> $psEditor |gm

   TypeName: Microsoft.PowerShell.EditorServices.Extensions.EditorObject

Name                  MemberType Definition
----                  ---------- ----------
Equals                Method     bool Equals(System.Object obj)
GetEditorContext      Method     Microsoft.PowerShell.EditorServices.Extensions.EditorContext GetEditorContext()
GetHashCode           Method     int GetHashCode()
GetType               Method     type GetType()
RegisterCommand       Method     bool RegisterCommand(Microsoft.PowerShell.EditorServices.Extensions.EditorCommand editorCommand)
ToString              Method     string ToString()
UnregisterCommand     Method     void UnregisterCommand(string commandName)
EditorServicesVersion Property   version EditorServicesVersion {get;}
Window                Property   Microsoft.PowerShell.EditorServices.Extensions.EditorWindow Window {get;}
Workspace             Property   Microsoft.PowerShell.EditorServices.Extensions.EditorWorkspace Workspace {get;}

Cheers,
Trevor Sullivan

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions