Commit graph

142 commits

Author SHA1 Message Date
ridiculousfish
f71b10df8c Don't suggest after | & or in comments
Fixes #1631
2014-08-24 14:39:41 -07:00
ridiculousfish
d0c85471b4 Make escape_string transform wildcard characters
The characters ANY_CHAR, ANY_STRING, and ANY_STRING_RECURSIVE are
currently transformed by unescape, but not by escape. Let's try escaping
them. Fixes #1614.
2014-08-16 19:25:36 -07:00
ridiculousfish
06400b83b1 Support for command wrapping ("aliases")
Add the --wraps option to 'complete' and 'function'. This allows a
command to (recursively) inherit the completions of a wrapped command.
Fixes #393.

When evaluating a completion, we inspect the entire "wrap chain" for a
command, i.e. we follow the sequence of wrapping until we either hit a
loop (which we silently ignore) or the end of the chain. We then
evaluate completions as if the wrapping command were substituted with
the wrapped command. Currently this only works for commands, i.e.
'complete --command gco --wraps git\ checkout' won't work (that would
seem to encroaching on abbreviations anyways). It might be useful to
show an error message for that case.

The commandline builtin reflects the commandline with the wrapped
command substituted in, so e.g. git completions (which inspect the
command line) will just work. This sort of command line munging is
also performed by 'complete -C' so it's not totally without precedent.

'alias will also now mark its generated function as wrapping the
'target.
2014-08-15 18:14:36 -07:00
ridiculousfish
e530af1ff7 Use adjusted_pos when determining the token for tab completing
redirecitons, per #1296
2014-05-03 00:15:13 -07:00
ridiculousfish
16b982958b Correctly complete redirections. Fixes #1296 2014-05-02 01:22:39 -07:00
ridiculousfish
0d3169ef70 Run restyle.sh to enforce style rules. 2014-03-31 10:01:39 -07:00
ridiculousfish
ad6367018b Excise use of parser_t's error() functionality. Thread a
parse_error_list_t through all of the expand functions, enabling them to
report errors more directly. Improve aspects of error reporting for
expansion failures.
2014-03-21 17:13:33 -07:00
ridiculousfish
e5ef45e4c0 Rewrite parser_t::test_args and parser_t::eval_args to use new parser 2014-03-20 21:32:02 -07:00
ridiculousfish
1c58b6d83e Rewrite parser_t::eval_args to use new AST parser 2014-03-20 21:32:02 -07:00
ridiculousfish
be33d3f2a4 Revert "Merge pull request #1317 from pullreq/cpp"
This reverts commit 74135c0600, reversing
changes made to 6d749789ce.

See discussion in #1317
2014-02-28 02:16:48 -08:00
Geoff Nixon
18dd6f58e3 Fixes .c -> .cpp in comments. For doxygen. 2014-02-27 06:23:40 -08:00
ridiculousfish
1de819e3de Fix for busted tab completions in for loop arguments, switch statements,
and other syntactic constructs. Fixes #1309
2014-02-21 19:55:55 -08:00
ridiculousfish
1fbf633817 Reimplement exec parsing. Instead of special-casing exec as a command,
promote it to a decoration (like 'command' or 'builtin'). This makes tab
completion and syntax highlighting treat exec's first argument as a
command and is otherwise a nice simplification. Fixes #1300
2014-02-13 10:10:49 -08:00
ridiculousfish
5ea7f52df2 Don't complete variables when single quoted. Fixes #1023 2014-02-09 15:27:04 -08:00
ridiculousfish
f6afddd94b Fix for tab-completing arguments. Closes #1261 2014-01-23 18:07:21 -08:00
ridiculousfish
53814983ff Update style and formatting to conform to fish style guide. 2014-01-15 01:40:40 -08:00
ridiculousfish
c22d94bba6 Fix for extra space when tab completing directories. Fixes #1241 2014-01-14 14:28:06 -08:00
ridiculousfish
096f850433 Eliminate class parse_t 2014-01-12 22:39:12 -08:00
ridiculousfish
89069fdaa4 Miscellaneous minor fixes based on cppcheck static analyzer 2014-01-12 13:33:35 -08:00
ridiculousfish
b34721b3f4 Miscellaneous optimizations to reduce string copying 2014-01-07 14:57:58 -08:00
ridiculousfish
358145c4bd Merge branch 'master' into ast 2014-01-01 15:32:50 -08:00
ridiculousfish
fb882f0b69 Support for stack overflow and infinite recursion detection in new
parser
2014-01-01 15:29:56 -08:00
Mandeep Sandhu
8078d29fda Fix completion bug for special fish characters.
Issue #1108: If there are special characters like '{' in the
completion suggestions, then we fail to parse it successfully
as we are passing an unescaped version of the character to
parser_t::eval_args(...).

This causes us to retun w/o completion suggestions.

This bug was discovered while implementing 'git stash' completion
as the suggestion contained strings like 'stash@\{0\}'.

Th fix is to properly escape the string before parsing it.
2013-12-30 12:20:44 +08:00
ridiculousfish
a23441109d Merge branch 'master' into ast
Conflicts:
	complete.cpp
	fish_tests.cpp
	highlight.cpp
2013-12-07 12:54:43 -08:00
ridiculousfish
263f919beb Replace autosuggestions "completions to load" mechanism with moderately
less hackish and far simpler "perform on main thread" mechanism
2013-11-29 23:44:26 -08:00
ridiculousfish
4aaa9e7d9f Allow autosuggestions to do job expansion. Fixes
https://github.com/fish-shell/fish-shell/issues/1152
2013-11-29 13:34:03 -08:00
ridiculousfish
34540babdb Merge branch 'master' into ast
Conflicts:
	complete.cpp
	fish_tests.cpp
2013-11-24 23:21:00 -08:00
ridiculousfish
9f6223311e Large cleanup and refactoring of unescape() function. 2013-11-24 22:58:39 -08:00
ridiculousfish
964c7e6f3b Merge branch 'master' into ast
Conflicts:
	complete.cpp
2013-10-27 13:37:14 -07:00
ridiculousfish
cf766b55cc Fix formatting 2013-10-26 15:27:39 -07:00
ridiculousfish
ce7c681462 Fix for bogus completions for function names 2013-10-13 16:46:02 -07:00
ridiculousfish
ddf98661e4 Adopt new parser in tab completions 2013-10-12 18:17:03 -07:00
Konrad Borowski
a62ebc9a69 Restore directories' tab completion without slash in command.
This is needed for implicit cd when ending command with `/`.
2013-10-01 08:29:40 +02:00
ridiculousfish
cbe615224d Make tok_last_type return an enum token_type instead of int 2013-09-30 13:57:36 -07:00
ridiculousfish
95d5e55df2 Don't do fuzzy matching for file completions for arguments beginning
with a dash, as suggested in #568
2013-09-15 00:00:35 -07:00
ridiculousfish
c38a40d193 Adjust prefix completions to sort alphabetically instead of by length.
Other completions are still sorted by length.
https://github.com/fish-shell/fish-shell/issues/923
2013-08-31 15:01:02 -07:00
ridiculousfish
464187491f Formatting 2013-06-02 01:14:26 -07:00
ridiculousfish
908b07527e Support for fuzzy completions
https://github.com/fish-shell/fish-shell/issues/568
https://github.com/fish-shell/fish-shell/issues/528
2013-05-25 15:41:18 -07:00
ridiculousfish
ef8ea97044 Prevent inline destructor of completion_t to reduce compiled code size a bit 2013-04-19 10:24:33 -07:00
ridiculousfish
e0e0bcdc1e Update code formatting 2013-03-21 17:44:51 -07:00
ridiculousfish
4d19bb17a9 Break out COMPLETE_NO_CASE and COMPLETE_REPLACES_TOKEN into separate flags, in preparation for upcoming fuzzy completion work 2013-03-05 20:54:16 -08:00
ridiculousfish
e7c1cb7185 Move autogenerated completions to ~/.config/fish/generated_completions/
https://github.com/fish-shell/fish-shell/issues/576
2013-02-17 16:14:36 -08:00
ridiculousfish
6d522e6ed6 First round of fixes based on cppcheck
https://github.com/fish-shell/fish-shell/issues/575
2013-02-16 00:02:40 -08:00
ridiculousfish
ad8d68dd43 Make subcommands modify $status, and make builtin_set not modify status unless it fails
https://github.com/fish-shell/fish-shell/issues/547
https://github.com/fish-shell/fish-shell/issues/214
2013-01-31 15:57:08 -08:00
ridiculousfish
edb973fadc Hack around xdm's dumb assumption that the login shell is POSIX compliant so we no longer kill OpenSUSE
https://github.com/fish-shell/fish-shell/issues/367
Also fix some formatting
2013-01-04 13:09:01 -08:00
ridiculousfish
dd317709f8 Fix to avoid suggesting files for empty tokens 2012-12-26 15:28:25 -08:00
ridiculousfish
644607c29f Eliminate str2wcs 2012-12-19 13:31:06 -08:00
ridiculousfish
6a8219a02e Remove Python dependency from Makefile and Xcode build
https://github.com/fish-shell/fish-shell/issues/429
2012-12-08 21:41:38 -08:00
ridiculousfish
918f84438f Don't autosuggest files until after we've tried (and maybe failed) to load completions
Fixes https://github.com/fish-shell/fish-shell/issues/378
2012-11-23 11:22:58 -08:00
ridiculousfish
93e2415924 Fix a memory leak 2012-11-23 11:14:16 -08:00