Tab Completion For Snap Connect In FISH Spams Errors

When using the FISH shell, tab completion for the snap connect command causes a stream of messages to be spewed out into the terminal. It seems it does successfully complete the line, but is rather confusing. 'snap interfaces' is deprecated; use 'snap connections'.
image

System information:

System:    Kernel: 5.4.0-33-generic x86_64 bits: 64 compiler: gcc v: 9.3.0 Desktop: Gnome 3.36.2 
           Distro: Ubuntu 20.04 LTS (Focal Fossa) 
Machine:   Type: Desktop Mobo: ASUSTeK model: PRIME B350-PLUS v: Rev X.0x serial: <filter> 
           UEFI: American Megatrends v: 5407 date: 12/31/2019 
CPU:       Topology: 8-Core model: AMD Ryzen 7 2700 bits: 64 type: MT MCP arch: Zen+ rev: 2 
           L2 cache: 4096 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 108799 
           Speed: 1377 MHz min/max: 1550/3400 MHz Core speeds (MHz): 1: 1379 2: 1374 3: 1374 4: 1378 
           5: 1377 6: 1377 7: 1377 8: 1377 9: 1378 10: 1377 11: 1377 12: 1377 13: 1378 14: 1377 
           15: 1375 16: 1376 
Graphics:  Device-1: AMD Navi 10 [Radeon RX 5600 OEM/5600 XT / 5700/5700 XT] vendor: XFX Pine 
           driver: amdgpu v: kernel bus ID: 0c:00.0 
           Display: x11 server: X.Org 1.20.8 driver: amdgpu resolution: 3840x1080~144Hz 
           OpenGL: renderer: AMD Radeon RX 5700 XT (NAVI10 DRM 3.35.0 5.4.0-33-generic LLVM 9.0.1) 
           v: 4.6 Mesa 20.0.4 direct render: Yes 
Audio:     Device-1: Creative Labs Sound Core3D [Sound Blaster Recon3D / Z-Series] 
           driver: snd_hda_intel v: kernel bus ID: 09:00.0 
           Device-2: AMD Navi 10 HDMI Audio driver: snd_hda_intel v: kernel bus ID: 0c:00.1 
           Device-3: AMD Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel 
           bus ID: 0e:00.3 
           Device-4: Logitech HD Pro Webcam C920 type: USB driver: snd-usb-audio,uvcvideo 
           bus ID: 1-1.4:4 
           Device-5: C-Media Blue Snowball type: USB driver: hid-generic,snd-usb-audio,usbhid 
           bus ID: 3-4:2 
           Device-6: Kingston HyperX Virtual Surround Sound type: USB 
           driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-9:6 
           Sound Server: ALSA v: k5.4.0-33-generic 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK 
           driver: r8169 v: kernel port: f000 bus ID: 04:00.0 
           IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 6.60 TiB used: 90.44 GiB (1.3%) 
           ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 960 EVO 250GB size: 232.89 GiB 
           ID-2: /dev/sda vendor: Western Digital model: WDS500G2B0A-00SM50 size: 465.76 GiB 
           temp: 26 C 
           ID-3: /dev/sdb vendor: Western Digital model: WDS500G2B0A-00SM50 size: 465.76 GiB 
           temp: 24 C 
           ID-4: /dev/sdc vendor: Western Digital model: WDS500G2B0A-00SM50 size: 465.76 GiB 
           temp: 25 C 
           ID-5: /dev/sdd type: USB vendor: Western Digital model: WD easystore 2624 size: 4.55 TiB 
           ID-6: /dev/sde vendor: Western Digital model: WDS500G2B0A-00SM50 size: 465.76 GiB 
           temp: 26 C 
Partition: ID-1: / size: 223.52 GiB used: 46.62 GiB (20.9%) fs: btrfs dev: /dev/nvme0n1p3 
           ID-2: /boot size: 945.6 MiB used: 138.3 MiB (14.6%) fs: ext4 dev: /dev/nvme0n1p2 
           ID-3: /home size: 223.52 GiB used: 46.62 GiB (20.9%) fs: btrfs dev: /dev/nvme0n1p3 
           ID-4: swap-1 size: 7.46 GiB used: 3.2 MiB (0.0%) fs: swap dev: /dev/nvme0n1p4 
Sensors:   System Temperatures: cpu: 29.2 C mobo: N/A gpu: amdgpu temp: 42 C 
           Fan Speeds (RPM): N/A gpu: amdgpu fan: 0 
Info:      Processes: 491 Uptime: 2h 17m Memory: 31.36 GiB used: 4.80 GiB (15.3%) Init: systemd 
           runlevel: 5 Compilers: gcc: 9.3.0 Shell: fish v: 3.1.0 inxi: 3.0.38 
schykle@schy-ryze-hori ~> 

Software information:

snap    2.45
snapd   2.45
series  16
ubuntu  20.04
kernel  5.4.0-33-generic
fish, version 3.1.0

The snapd package does not ship any completion for fish. Do you know where the suggestions come from?

No idea, TBH. I can only assume that either FISH is triggering something when trying to find completions, or that there’s a separate package that contains completions for snap, if it’s not provided by snapd itself. – My understanding of this particular function is severely lacking, though I’d love to improve this.

We’d welcome any pull requests addressing improving the completion for fish.

I’ve recently added some completion support for zsh which is now included in 2.45. The original change for zsh was proposed in https://github.com/snapcore/snapd/pull/8580. There’s also completion support for bash included in the package. Perhaps you can take a look at those files to get you started with a similar thing for fish.

Edit: I see there is some completion support in fish arleady. On Arch the fish package ships /usr/share/fish/completions/snap.fish (part of fish-common on Ubuntu). Perhaps the issue, if any, should be addressed in the upstream file right here: https://github.com/fish-shell/fish-shell/blob/master/share/completions/snap.fish

Opened a PR with a in fish upstream: https://github.com/fish-shell/fish-shell/pull/7104