carapace-bin icon indicating copy to clipboard operation
carapace-bin copied to clipboard

nom-build: zsh bridge does not work

Open Atemu opened this issue 9 months ago • 4 comments

Current Behavior

Attempting to complete nom-build which ships a zsh-completion in CARAPACE_BRIDGES=zsh nu does not work: NO RECORDS FOUND.

Perhaps this is to do with the completion being equal to some other completion?

Expected Behavior

It should do zsh nix-build completions for nom-build.

Steps To Reproduce

  1. In an env where zsh and nix-output-monitor are installed
  2. Run CARAPACE_BRIDGES=zsh nu
  3. Try to complete nom-build <TAB>

Version

1.0.2

OS

  • [X] Linux
  • [ ] OSX
  • [ ] Windows

Shell

  • [ ] Bash
  • [ ] Elvish
  • [ ] Fish
  • [X] Nushell
  • [ ] Oil
  • [ ] Powershell
  • [ ] Xonsh
  • [ ] Zsh

Anything else?

Nom basically declares itself as an alias. That may be the reason?

Related to this: Should carapace attempt to use its own completions for the command aliased by the bridge or should it use the bridge's aliased command via the bridge too?

Least surprise would probably be to use the aliased command completion via the bridge as command aliases should be handled by carapace itself for native completions.

Atemu avatar May 06 '24 13:05 Atemu

Nom basically declares itself as an alias. That may be the reason?

Yeah possibly. Haven't gone too deeply into that edge case.

Apart from that carapace uses a custom config at ~/.config/carapace/bridge/zsh/.zshrc, so if the nom-build completion is registerd in ~/.zshrc that needs to be repeated there.

There's a custom completer for nix-build in carapace. Might be easier to just bridge completions for that one with a spec:

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

rsteube avatar May 06 '24 15:05 rsteube

Oh so that's what the carapace bridge is for; it struck me as kind of odd.

Atemu avatar May 06 '24 18:05 Atemu

Sourcing the users .zshrc can be very slow (depending on whate users put in there) and have some nasty side effects. So I'm kinda forced to use a seperate one. System wide registered completions should work though.

rsteube avatar May 06 '24 18:05 rsteube

Ah, sorry I forgot to reply to that part; this is indeed a system-wide completion. It's not at the usual path as I'm on NixOS but the default system zsh is made to discover it just fine.

Atemu avatar May 07 '24 12:05 Atemu