The previous completion generation was broken for several reasons:
* ./foo would break detection of suffix due to the leading . being
interpreted an extension marker,
* ./foo would be completed as foo, which would be excluded from
matching inrcomplete.cpp
Using `git for-each-ref` both simplifies the code (no need to deal
with detached heads anymore) and speeds it up.
With 1600 branches, the time goes from ~48ms to ~16ms.
- fix capitalization
- shorten descriptions
- implement subcommand shortcuts
- add arg completion for 'limit' and 'depth' switches
- improve arg completion for list subcommand in case of -p switch
bower was calling `__fish_should_complete_args`, the old name for
`__fish_should_complete_switches.`
yarn was parsing bower.json instead of package.json.
To be used by completions to directly determine whether it is either
possible or preferable to complete a switch (instead of a subcommand),
(presuming that switches must come before subcommands).
* __fish_can_complete_switches: we are in a position where a switch may
be placed.
* __fish_should_complete_switches: we're in a position to accept a
switch and the current token starts with `-` so we have no choice but
to do so.
Selectively reverts 156d4fb9b9.
`all-the-package-names` is still used to generate completions for `npm`
if it is installed, but it is not manually installed nor updated. It is
now the user's responsibility to do both, and it must be installed
globally.
`npm search` was _way_ too slow to be used for dynamic completions, so
using a cached list of all avaialable NPM packages to match against.
This is a bit brave for a fish completion, but the npm package
`all-the-package-names` has a list of, well, all the package names
avaialable for installation via the default npm registry. Installing a
copy locally to $HOME/.cache/fish/npm_completions and using that to
search for packages matching the tokenized command line.
Preference would be to call `__update_atpm` in the background, but that
emits an ugly "job has completed" message..
Should also use this for completions for `yarn add`.
Instead, attempt to extract the message that _would_ be displayed on
execution of `./configure --help` by relying on some markers present in
autoconf-generated configure files.
As measured with 'hyperfine' on a laptop running in reduced frequency
power savings mode, `fish -c "__fish_parse_configure ./configure"`
runtime dropped from ~1.25s to ~0.8ms, which is inline with the
previously observed ~350ms execution time for `./configure --help`.
fish's own startup time is approximately 75ms before parsing begins.
Still very slow, but much better.
This relies on the new `read --line/-L` support as an entire parser for
the output of `./configure --help` was written in fishscript. Also
doesn't work without 72f32e6d8a7905b064680ec4b578c41dea62bf84.
The completion script is slow... a function of both the autotools
configure script itself being written in a shell script combined with a
fishscript output parser.
fish's own `./configure --help` takes around 350ms to execute, while
`__fish_parse_configure ./configure` (which runs that behind the scenes)
takes around 660ms to run, all-in-all - a not insignificant overhead.
Output can be cached (based off of ./configure hash or mtime) in the
future if this is a big deal.
complete.cpp strips the path from commands before parsing for
completions, meaning that when we called `path_get_path()` against
`cmd`, if `./cmd` were typed in at the command line but `cmd` does not
exist in the PATH, then the command would incorrectly be flagged as not
present and the completions would be skipped.
This is also faster when an absolute/relative path is used for a
command, as we now search with the original path which skips searching
PATH directories unnecessarily.
Found when debugging why completions for `./configure` wouldn't work.
`read` with IFS empty was expected to set all parameters after the first
n filled variables to an empty string, but that was inconsistent with
the behavior of `read` everywhere else.
I'm not sure why fish differed from the spec with regards to the
behavior in the event of an empty IFS: we eschew IFS where possible, yet
here we adopt non-standard behavior splitting on every (unicode)
character instead of not splitting at all with IFS empty. We still do
that, but now the unset variables are treated as they normally would be,
i.e. cleared and not set to an empty string (which is what an empty
value between two IFS separators would contain).