Skip to content

completion for gradle wrapper doesn't work properly #10127

Closed

Description

@cvmocanu

First, thanks a lot for fish. I just discovered it, and I wonder why did I waste so much time with zsh.

Now for the problem: completion for ./gradlew (the Gradle wrapper) doesn't work by default.

To reproduce:

  • open a new fish terminal
  • go to the root directory of a Gradle project
  • type ./gradlew --<press TAB>
  • note that no completions are shown

The problem can be reproduced with a clean config ( sh -c 'env HOME=$(mktemp -d) XDG_CONFIG_HOME= fish').

Workaround:

  • type gradle --<press TAB> (this will show completions and also load the completions for gradlew)
  • now ./gradlew --<press TAB> shows completions

Please fix this, as the workaround is very inconvenient, and it can't be automated (I need to do it every time I open a new terminal).

Probably there needs to be a dedicated file for gradlew.fish in /usr/share/fish/completions that wraps the gradle completions.

Background information:

  • fish --version: fish, version 3.6.1
  • uname -a: Linux cvmocanu-thinkpad 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 2 18:01:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
  • Xubuntu 22.04.3 LTS
  • Xfce 4.16
  • echo $TERM: xterm-256color
  • xfce4-terminal --version: xfce4-terminal 0.8.10 (Xfce 4.16)

Activity

  1. faho commented on Nov 29, 2023

    @faho
    Member

    Fixed by 180692f, to be released in 3.7.0.

  2. added this to the fish 3.7.0 milestone on Nov 29, 2023
  3. cvmocanu commented on Nov 29, 2023

    @cvmocanu
    Author

    Hi @faho, thanks for this.
    I tried your fix locally (by creating the gradlew.fish file in /usr/share/fish/completions) and it still doesn't work. Did you test that commit? Does it work for you?

  4. jvican commented on Dec 2, 2023

    @jvican

    Same thing here. It doesn't work for me either.
    The workaround helps, but it also seems that it doesn't show any project names, only CLI flags when typing ./gradlew --<TAB>.

  5. faho commented on Dec 2, 2023

    @faho
    Member

    What you're seeing here is that fish won't load completions for commands it can't find via $PATH (#9133).

    This is because it wouldn't use the relative path you're using if the completions called just e.g. gradle (#3117), and would then error out.

    It appears neither of you has gradle installed globally, and you rely on running it via ./gradle, which unfortunately hits this case.

    What you can do in that case is to eagerly load the completion - source /usr/share/fish/completions/gradle.fish.

  6. cvmocanu commented on Dec 4, 2023

    @cvmocanu
    Author

    fish won't load completions for commands it can't find via $PATH (#9133)

    If I understand that correctly, then it's a bigger bug that needs fixing:

    • I'm in a directory that contains a shell script ./gradlew
    • the script is executable
    • I'm typing ./gradlew {TAB}
    • I'm not getting completions because ./gradlew is not in $PATH. But this is completely wrong. I should get completion every time I can execute that command correctly and that includes (1) being in $PATH, (2) having a correct relative path (this case); (3) having a correct absolute path.
  7. faho commented on Dec 4, 2023

    @faho
    Member

    t's a bigger bug that needs fixing:

    Yes, it is #3117

  8. locked as resolved and limited conversation to collaborators on Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions