PowerShell / PowerShell/vscode-powershell
Feature Request: Call VSCode commands from $psEditor variable
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 547
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the built-in $psEditor EditorObject API, especially its Workspace, Window, GetEditorContext(), RegisterCommand(), and UnregisterCommand() members, and compare the broader request with related issue #773. Done means a PowerShell script in the VSCode-PowerShell environment can invoke VSCode commands through $psEditor.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100