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

completion double tab should show rest of the strings #405

Closed
jcubic opened this issue Jun 12, 2018 · 3 comments
Closed

completion double tab should show rest of the strings #405

jcubic opened this issue Jun 12, 2018 · 3 comments

Comments

@jcubic
Copy link
Owner

jcubic commented Jun 12, 2018

Expected behavior

If you have paths that you complete and you returning path + dir or path + file when press you double tab it should only show file or dir not whole text

Actual behavior

it show whole paths

Steps to reproduce

  • open https://jcubic.github.io/git/
  • clone jcubic/git repo
  • type ls /git/.git
  • press tab twice
  • it echo: git/.git/ git/.github/ and it should display .git/ .github/
@jcubic
Copy link
Owner Author

jcubic commented Jun 23, 2018

This is not possible because, common string will remove git/.git and completion code can't know about the context of paths, it would require new API maybe callback function that will be called with array of matched strings and user will be able to call echo on that array and remove what he things is correct.

@jcubic
Copy link
Owner Author

jcubic commented Jun 23, 2018

doubleTab: function(arr) {
   this.echo(arr.map(function(completion) {
       return completion.replace(/.*\/([^\/]+)\/?$/, '$1');
   }));
}

jcubic added a commit that referenced this issue Jun 23, 2018
@jcubic
Copy link
Owner Author

jcubic commented Jun 23, 2018

the API look like this:

doubleTab: function(string, arr, echo_command) {
   echo_command();
   this.echo(arr.map(function(completion) {
       return completion.replace(/.*\/([^\/]+)\/?$/, '$1');
   }));
}

you don't need to call echo_command, if you don't want prompt + command like with normal completion.

jcubic added a commit that referenced this issue Jun 30, 2018
@jcubic jcubic closed this as completed Jul 1, 2018
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

1 participant