Skip to content

Support for functions autocomplete in PowerShell #1122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
konopkap opened this issue Apr 11, 2025 · 1 comment
Closed

Support for functions autocomplete in PowerShell #1122

konopkap opened this issue Apr 11, 2025 · 1 comment
Labels
enhancement New feature or request fund Fundable with polar.sh

Comments

@konopkap
Copy link

konopkap commented Apr 11, 2025

Request

By design Powershell aliases (created with Set-Alias does not support commands with arguments (e.g. git switch). It is required to create a function for that:

function gsw { 
    git switch $args
}

However with such a definition carapace autocompletion does not work for alias gsw - it will only work for full name of git switch.

Proposed solution

Support for functions autocompletion would make carapace more useful with use of powershell aliases. Or maybe there's some configuration to already do it - but I missed to find it.

Anything else?

No response

Polar

Fund with Polar
@konopkap konopkap added enhancement New feature or request fund Fundable with polar.sh labels Apr 11, 2025
@rsteube
Copy link
Member

rsteube commented Apr 12, 2025

You can use a spec:

# yaml-language-server: $schema=https://carapace.sh/schemas/command.json
name: gsw
parsing: disabled
completion:
  positionalany: ["$carapace.bridge.CarapaceBin([git, switch])"]

or alias it with run instead of the Powershell function:

# yaml-language-server: $schema=https://carapace.sh/schemas/command.json
name: gsw
run: "[git, switch]"

Save it as gsw.yaml in the folder shown in carapace --help:

Specs are loaded from ...

@rsteube rsteube closed this as completed May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fund Fundable with polar.sh
Projects
None yet
Development

No branches or pull requests

2 participants