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

Bash autocompletion for coala does not add anything? #388

Closed
Naereen opened this issue Jan 11, 2017 · 12 comments · Fixed by #424
Closed

Bash autocompletion for coala does not add anything? #388

Naereen opened this issue Jan 11, 2017 · 12 comments · Fixed by #424
Assignees

Comments

@Naereen
Copy link

Naereen commented Jan 11, 2017

Hi,

I followed the instructions about autocompletion, with latest versions of coala and argcomplete, and updated my .bashrc as suggested, but absolutely nothing has changed: the autocompletion for coala command line program is not loaded (on the same shell or a new shell).

Any one else having the same issue ?
(I'm on XUbuntu 16.10, Bash v4.3, coala 0.9.1, argcomplete 1.7.0 on Python 3.5.2)

Any idea of what can I do to fix it ?
Thanks in advance.

@Naereen
Copy link
Author

Naereen commented Jan 11, 2017

Note: this issue could possibly be for coala/coala repository instead.

@sils
Copy link
Member

sils commented Jan 11, 2017

Hm I have spoken with someone somewhen with the same issue but I wasn't able to reproduce it yet...

@Naereen
Copy link
Author

Naereen commented Jan 12, 2017

I think a possible explanation is that the script /usr/local/bin/coala (result of $(which coala)) is only 5-line long, and does not contain for itself the calls to the argparse module. So maybe that's why the argcomplete script fails to generate completion for it?

If you think that could be it, I will find the "complete" coala script and call register-python-argcomplete on it, to see if it changes anything.

@sils
Copy link
Member

sils commented Jan 12, 2017

Don't think so, as it works for others...

The coala script is generated, it imports a main method and runs it. This is needed because those scripts are a bit platform dependent, Windows greets.

@sils
Copy link
Member

sils commented Jan 12, 2017

@Naereen indeed it doesn't work with bash for me as well :/ with ZSH it works fine, that's what I use normally. I'm currenlty checking https://pypi.python.org/pypi/argcomplete for what we're doing wrong.

@Naereen
Copy link
Author

Naereen commented Jan 12, 2017

OK. Thanks for trying. Please tell me if I can be of any help.

@alisianoi
Copy link

For me autocompletion does not work for both global install and virtual environment install with bash 4.4.12, argcomplete 1.8.2 and coala 0.10.0.

When I switch to zsh, autocompletion works for global install but does not work, when I install everything in a virtual environment. My zsh is 5.3.1

Personally, I find it strange that for me there is no autocompletion in virtual environments.

@alisianoi
Copy link

alisianoi commented Feb 28, 2017

Here is what worked for me in both shells: replacing which coala with coala, i.e.

Instead of the following line in both .bashrc and .zshrc:

eval "$(register-python-argcomplete `which coala`)"

using this line worked both inside and outside of a virtual environment:

eval "$(register-python-argcomplete coala)"

Please note that you might have to <TAB> up to three times to trigger your autocompletes.

@sils and @Naereen, could you confirm that it fixes your issues? Doing a source ~/.bashrc (or ~/.zshrc) might also help when activating a virtual environment.

For me coala --fi<TAB><TAB> completes to coala --files and offers --filter-by-language as second.

@Naereen
Copy link
Author

Naereen commented Mar 1, 2017

Now it works, by using your trick. 👏

Instead of changing a .bashrc file, I added the response of register-python-argcomplete --shell bash coala as a coala.bash_completion file, in my ~/.bash_completion.d/ folder.

Thanks @all3fox for following up on this issue. (it's OK to close it now?)

@alisianoi
Copy link

@Naereen nice! No, don't close the issue, I will create a PR to update coala docs + inform guys from argcomplete that their script register-python-autocomplete possibly does not handle paths very well (which coala gives a path). Then I will close it.

@Naereen
Copy link
Author

Naereen commented Mar 1, 2017

OK.
I don't know what script is that, the only one I have is register-python-argcomplete, not register-python-autocomplete (and even the latest version has no auto..)

@alisianoi
Copy link

sry, sry, I am on the go right now, did not check the script name. Nevermind, we will take care of the issue from here, thanks )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

4 participants