task icon indicating copy to clipboard operation
task copied to clipboard

Autocompletion does not work from subfolders

Open TheKangaroo opened this issue 2 years ago • 7 comments

I'm not 100% sure if this is a bug report or a feature request. I love the new feature that you can call task from all subfolders (https://github.com/go-task/task/pull/920) but it seems like autocompletion is not working in this case. Is this something that can be fixed easily?

  • Task version: v3.19.0
  • Operating System: macOS Ventura

TheKangaroo avatar Dec 08 '22 08:12 TheKangaroo

@TheKangaroo What shell are you using? ~~I can replicate this on zsh. If you're also on zsh then a temporary fix for you is to just comment out the following line in the completion script:~~

# (( enabled )) || return 0

I haven't really played with the completion scripts before, so I'm not sure if the existent checks are necessary for any reason. I suspect they're not needed now that we're walking up the directory tree to search for files.


Edit: going to categorise as a bug since this is unintended behaviour

pd93 avatar Dec 08 '22 09:12 pd93

@TheKangaroo I've just tried this again with ZSH and it now seems to be working for me without any changes. Not sure what changed. Could you confirm what shell you're using and how you have configured your completions?

pd93 avatar Dec 10 '22 23:12 pd93

Sorry for the late response. I'm on zsh too and I can make it work with commenting out the enabled check. It won't work without this though.

TheKangaroo avatar Dec 12 '22 07:12 TheKangaroo

Sorry, I missed the part with the configuration. I have the following lines in my zshrc

export FPATH="$FPATH:/opt/homebrew/share/zsh/site-functions"
autoload -U compinit && compinit -i
compdef _task task

I think I found this somewhere on the discord.

TheKangaroo avatar Dec 14 '22 07:12 TheKangaroo

Sorry for the late response. I'm on zsh too and I can make it work with commenting out the enabled check. It won't work without this though.

Also zsh, same problem, same solution. I'd expect the completion scripts to have unified logic to some degree 🤔

adamzapasnik avatar Jan 02 '23 11:01 adamzapasnik

Same issue on macOS Monterey, task version: 3.20.0, zsh version 5.8.1.

It does not work for me even by commenting the enabled check.

As a workaround, I created an alias in my ~/.zshrc that points to my "main" taskfile, like this: alias tk='task -t /path/to/folder/Taskfile.yaml'

I believe the autocompletion logic cannot print the list of available tasks when running in a subfolder without the -t flag .

lc3r avatar Feb 16 '23 22:02 lc3r

The same issue on Linux Ubuntu 22.04, Task version v3.33.1.

It worked before updating to the latest version in subdirectories, but now it only works in the root directory. I have yet to revert to the previous versions to test.

Update: I tested on the previous couple of versions, and it's the same. I'm unsure what changed on my machine to break this because nothing major happened recently. Can anyone provide suggestions on how I can debug this? Thanks in advance!

artemudovyk avatar Jan 09 '24 12:01 artemudovyk