Skip to content

Provide a way to exclude cmdlets from some modules from completions in a concrete powershell session #16747

@javiercn

Description

@javiercn

Summary of the new feature / enhancement

As a user I want to configure my powershell profile to exclude completion from certain modules that I'm not using on a given context. For example, as a developer when I'm on a powershell session and type Remove-I for (remove-item) the first result I get on autocompletion is Remove-InitiatorId.

In many scenarios like these, some commands that won't ever be used in this context lead to a poor experience where you need to either type more characters to disambiguate or tab through.

It's great that by default you can get commands from all installed modules for discoverability, but with the growing number of modules it becomes painful to use on a regular session.

To provide an analogy, this is similar to importing all namespaces by default on C#, each type is readily available, but searching through the types becomes much more problematic because they are way more irrelevant types in scope.

Proposed technical implementation details (optional)

Ideally this would be either an allow list or a block list (possibly an allow list), where you can set your preferences for the session via a cmd-let to filter completions to the modules you've defined.

Set-CommandCompletion Microsoft.PowerShell.Utility, Microsoft.PowerShell.Management

That will make only commands in those modules to be considered for completions and you can put this on your $Profile so that it happens every time you create a new session.

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