cod icon indicating copy to clipboard operation
cod copied to clipboard

Path completion don't work

Open Strongleong opened this issue 2 years ago • 7 comments

Can't really come up with good title, sorry. Bad English knowledge.

So, I made bare git repository for my dot files and make alias config for this repo. After config -h cod picked up possible flags and commands as expected. But when I try type something like config add ~/.config/ and press TAB nothing happens.

Strongleong avatar May 17 '22 22:05 Strongleong

Are you sure, cod learned completions? I have following doubts:

  • cod doesn't support shell aliases (what kind of alias did you create?)
  • cod doesn't learn -h flag by default, it learns only full --help flag (or did you invoke cod learn explicitly)?

You can try cod list. Does it show your command config -h?

dim-an avatar May 18 '22 15:05 dim-an

  1. My alias: alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME'
  2. I typed config --help, sorry for my mistake in original post :sweat_smile:
  3. My cod list:
~ > cod list
2	/usr/bin/fd --help
3	/usr/bin/git '--git-dir=$HOME/dotfiles/' '--work-tree=$HOME' --help
5	/usr/local/bin/phpactor --help
1	/usr/bin/pip --help

Cod definitely detected help page for my alias, it can autocomplete all of git commands and flags. But do not autocomplete files(

Strongleong avatar May 18 '22 22:05 Strongleong

Are you using bash shell? Can you please show me output of complete command? (It shows how completion is configured for all of your commands).

dim-an avatar May 23 '22 12:05 dim-an

I am using zsh shell. Nor complete, nor cod complete don't wokrs

Strongleong avatar May 24 '22 05:05 Strongleong

zsh stores functions used in completions in _comps map. Could you please provide output of such command

for key value in ${(kv)_comps}; do echo "$key -> $value" ; done

dim-an avatar May 24 '22 07:05 dim-an

Output of this command is to long, I post it on pastebin

https://pastebin.com/zjuXtrWK

Strongleong avatar May 24 '22 22:05 Strongleong

https://pastebin.com/zjuXtrWK git -> _git

So your git command is completed using built in _git function (that's not surprising, zsh has a lot of completions by default). When cod takeovers completion of the command, entries in _comp

Example from my machine:

ipython3 -> __cod_complete_zsh
logrep -> __cod_complete_zsh
cod -> __cod_complete_zsh

So we have 2 questions:

  1. Why your default _git completion doesn't complete filenames (and I'm afraid I'm not an expert here).
  2. Why cod didn't takeover git completion. I'll take a look at that.

dim-an avatar May 25 '22 08:05 dim-an