PowerShell / PowerShell/PowerShellEditorServices

Add blocklist/inclusion list for editor commands

Open
#247 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-psEditor Issue-Enhancement
Dominant language
C#
Stars
767
Forks
266
Avg merge
3d 16h
Merged PRs (30d)
1

Description

Eventually there is going to be a need to ignore certain Commands or Modules when PSES Registers Commands.

Here are the ideas I have had.

  • Block all Registering from outside of Profile
  • Block all Registering from Blacklisted Modules.
  • Only Allow Registering from Whitelisted Modules
  • Only Allow Registering Whitelisted Commands

You can currently do something like the following:

# Microsoft.VSCode_profile.ps1
Import-Module Blah1
Import-Module Blah2
Import-Module Blah3
Import-Module Blah4
Import-Module Blah5

# Do All The Things Here

Unregister-EditorCommand -Name Command1FromBlah1
Unregister-EditorCommand -Name Command2FromBlah1
Unregister-EditorCommand -Name Command1FromBlah2
Unregister-EditorCommand -Name Command2FromBlah2
Unregister-EditorCommand -Name Command3FromBlah3
Unregister-EditorCommand -Name Command1FromBlah4
Unregister-EditorCommand -Name Command1FromBlah5
Unregister-EditorCommand -Name Command2FromBlah5
Unregister-EditorCommand -Name Command3FromBlah5

However, this would quickly become a headache and hard to maintain if a Module is regularly adding commands etc.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing how PSES registers commands and how Unregister-EditorCommand removes them, using the profile example as the expected configuration context. Compare the proposed module and command allowlists/blocklists and clarify which policy should be supported first. Done means a decided registration policy that avoids manually unregistering commands as modules change.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.