mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 21:43:55 +08:00
5ad292328a
Use clang/clang++'s own autocompletion support to complete arguments. It is rather convoluted as clang generates autocompletions for a portion of the current token rather than the entire token, e.g. while `--st` will autocomplete to `--std=` (which is fine by fish), `--std=g` will autocomplete to `gnu...` without the leading `--std=` which breaks fish' support for the completion. Additionally, on systems where clang/clang++ is the system compiler (such as FreeBSD), it is very often for users to invoke a newer version of clang/clang++ installed as clang[++]-NN instead of clang. Using a monkey-patched version of `complete -p` to support that without breaking (future) completions for commands like `clang-format`. Closes #4174.
8 lines
475 B
Fish
8 lines
475 B
Fish
# Multiple versions are often installed as clang++, clang++-7, clang++-8, etc.
|
|
# They won't be autoloaded, but once clang++ is used once, they'll gain completions too.
|
|
# This could potentially be moved to __fish_config_interactive.fish in the future.
|
|
|
|
complete -p '*clang++*' -n '__fish_should_complete_switches' -xa '(__fish_clang_complete)'
|
|
complete -p '*clang++*' -n 'not __fish_should_complete_switches' \
|
|
-xa '(__fish_complete_suffix \'{.o,.out,.c,.cpp,.so,.dylib}\')'
|