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

Clarify that filtering by prefix is not required in completers #139

Closed
kislyuk opened this issue Jul 13, 2016 · 10 comments
Closed

Clarify that filtering by prefix is not required in completers #139

kislyuk opened this issue Jul 13, 2016 · 10 comments

Comments

@kislyuk
Copy link
Owner

kislyuk commented Jul 13, 2016

See #137

@haifengkao
Copy link

really?

argcomplete.autocomplete(parser, validator=lambda x, y: True)
will not show anything.

I have to use
argcomplete.autocomplete(parser, validator=None)
for argcomplete to work

@haifengkao
Copy link

The problem seems to be related to zsh.
output_stream.write('/usr/hello'.encode(sys_encoding))
only works if the prefix of '/usr/hello' matches the suffix in the terminal

@evanunderscore
Copy link
Collaborator

I feel like the choices completer (and probably the others too) should not filter their results and defer to the validator to do the filtering. As it stands, if I want to do something like case-insensitive completion, I have to override the choices completer because the results are already filtered before they get to the validator. Or am I misunderstanding the purpose of the validator?

@kislyuk
Copy link
Owner Author

kislyuk commented Jul 18, 2016

@haifengkao, it would be really awesome if a test could be added for this behavior. I'd like to create a pexpect test that would verify completions end-to-end in bash and zsh. Do you want to help?

@evanunderscore, the choices completer is presented as an example. The validator was added to this architecture after I first designed it, so I'm treating it as a general purpose filtering step. One of its functions is to filter the completions by prefix. The completer may also do so, for example if filtering will reduce the amount of work done (like when requesting completions from a remote API). Case insensitive completion is not generally supported. If you want it supported, please open another issue. We'll need to update the docs, think about how to communicate case insensitivity to completers, and add a CaseInsensitiveValidator.

@haifengkao
Copy link

@kislyuk sure. what do you need?

@kislyuk
Copy link
Owner Author

kislyuk commented Jul 19, 2016

A test for the zsh behavior that you described (positive and negative test assertions). You may have to modify travis.yml to get zsh and pexpect installed.

@haifengkao
Copy link

The current tests are pure python and they don't involve the shell at all.
Do you want me to set up a new test framework for you?

@kislyuk
Copy link
Owner Author

kislyuk commented Jul 19, 2016

We would need a new test case that uses pexpect. I would like to have it added in a new class in test/test.py.

@haifengkao
Copy link

I was doing a little research (http://www.zsh.org/mla/users/2013/msg00612.html).
Zsh has its own filtering system, which can be turned off by compadd -U. However, the link above suggests this -U option is not available in bash compatibility mode.

@evanunderscore
Copy link
Collaborator

Assuming zsh is sufficiently covered by #10 and #141.

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

No branches or pull requests

3 participants