Skip to content
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

Autocompletion does not work from subfolders #950

Open
TheKangaroo opened this issue Dec 8, 2022 · 7 comments
Open

Autocompletion does not work from subfolders #950

TheKangaroo opened this issue Dec 8, 2022 · 7 comments
Labels
area: completions Changes related to shell completions and scripts.

Comments

@TheKangaroo
Copy link

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 (#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
@github-actions github-actions bot added the state: needs triage Waiting to be triaged by a maintainer. label Dec 8, 2022
@pd93
Copy link
Member

pd93 commented Dec 8, 2022

@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 pd93 added type: bug Something not working as intended. area: completions Changes related to shell completions and scripts. and removed state: needs triage Waiting to be triaged by a maintainer. labels Dec 8, 2022
@pd93
Copy link
Member

pd93 commented Dec 10, 2022

@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 pd93 added the state: awaiting response Waiting for issue author to respond. label Dec 10, 2022
@TheKangaroo
Copy link
Author

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.

@github-actions github-actions bot removed the state: awaiting response Waiting for issue author to respond. label Dec 12, 2022
@TheKangaroo
Copy link
Author

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.

@adamzapasnik
Copy link

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 🤔

@lc3r
Copy link

lc3r commented Feb 16, 2023

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 .

@artemudovyk
Copy link

artemudovyk commented Jan 9, 2024

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!

@pd93 pd93 removed the type: bug Something not working as intended. label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: completions Changes related to shell completions and scripts.
Projects
None yet
Development

No branches or pull requests

5 participants