-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
WIP Completion for fish #829
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
Conversation
|
I'm not familiar with fish so I cannot comment on that part of it. In general the way completion is supposed to work is that the shell should send a list of words each separated from the next by a newline upto the word the cursor is currently on. If the cursor is not on a word (i.e. it is after a psace) there should be two newlines at the end. You can change this scheme as you like by implementing an appropriate input_parser in complete.py for your shell. kitty then responds by printing out a shell script on stdout that is evaled by the shell to set the completions. After you have implemented this scheme you should also add some instructions to docs/index.rst about how to enable the completions in fish, just as there are for bash and zsh. |
|
Great! Looks like I'm on track. Fish's completion works quite differently from Bash and Zsh. I've integrated many other tools to Fish in the past so I'll hopefully end up with a decent, working completion. Thanks for your initial review, @kovidgoyal 👍 I'll finish this ASAP (on my free time, of course). |
c717093 to
f600506
Compare
|
As a fish user, I would love it if this got merged. |
|
Me too, @skorokithakis! I think I'll have some free time tonight to advance on this! Stay tuned 😃 |
f600506 to
29af801
Compare
29af801 to
1b7244f
Compare
|
@kovidgoyal, Please review again. Would you like a test and feedback from another Fish user? BTW, @skorokithakis, did you have the chance to test this? Thanks! |
|
|
||
| @input_parser | ||
| def fish_input_parser(data): | ||
| return data.rstrip().splitlines(), True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not look right to me. new_word should be True only if the cursor is after a space.
For example:
kitty +kitt<cursor>
should have new_word False, while
kitty +kitten <cursor>
should have new_word True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thing is that completions work quite differently in Fish than in other command line shells. As Fish interprets and filters the completions suggestions, there's no need to work on completing the current partial token. Only if we're doing something really tricky with the partial token. In that sense, kitty +complete fish will always receive complete tokens.
|
OK as I said I dont know anything about fish -- so that was just a comment based on the other shells. In any case I have merged, since even if it does not work perfectly it is better than nothing. |
|
Great! I'll ask my dear friend @wpjunior to test it and post his feedback! No problem :-) I just wanted to explain that. I should have done this in the commit message – will do so the next time ;-) |
WIP – Please do not merge yet
I'm submitting this PR in its early stage to get some preliminar feedbacks and reviews, which are more than welcome.