ridiculousfish
1baa479bbf
Eliminate the global list of scoped transient commandlines
...
Store this in a parser's libdata instead.
2019-06-09 14:11:25 -07:00
Fabian Homborg
4ebb6cf39e
complete: Add "--force-files"
...
This allows a completion to specify that *it* takes files.
Useful for things like `sudo -e`, because sudo usually doesn't take
any files.
2019-05-30 19:13:42 +02:00
Fabian Homborg
d73ee4d54b
More using FLOGF when formatting is needed
...
sed-patched, every time a "%" is used in a call to `FLOG`, we use
`FLOGF` instead.
2019-05-30 11:54:09 +02:00
ridiculousfish
835c6ffa67
clang-format all files
2019-05-27 19:47:13 -07:00
ridiculousfish
ea9d1ad82f
Convert debug(0) calls to FLOG
2019-05-27 17:31:17 -07:00
ridiculousfish
b405b979ec
Eliminate the CHECK() macro
...
This thing was pretty useless.
2019-05-27 17:24:19 -07:00
Fabian Homborg
9ae3b345c8
Handle empty strings in compare_completions_by_tilde
...
Fixes #5895 .
2019-05-27 08:17:05 +02:00
Fabian Homborg
d0bd238657
Don't hardcode enum numbers
...
"1" in the context of `escape_string(..., 1)` is referring to
`ESCAPE_ALL`, so we should use that.
2019-05-24 18:19:11 +02:00
ridiculousfish
234c97e6d2
Remove some unused variables
2019-05-12 18:23:00 -07:00
Mahmoud Al-Qudsi
097d6c3c5b
Fix order of operations in tilde comparison
...
The previous form of the statement evaluated to a constant comparison
and couldn't have been what was actually intended.
2019-05-09 01:22:23 -05:00
Fabian Homborg
5bf21f2928
Penalize files ending in ~ in suggestions
...
Fixes #985 .
2019-05-06 17:07:29 +02:00
Fabian Homborg
c2970f9618
Reformat all files
...
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.
If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
ridiculousfish
fe68287cb0
Make miscellaneous variables thread-safe
2019-05-04 20:58:35 -07:00
ridiculousfish
1e57424011
Thread a parser into function_exists
...
Since this may autoload, it needs a parser with which to autoload.
2019-05-04 20:20:52 -07:00
ridiculousfish
bffacd2fbf
Thread a parser into expansion
...
Expansion may perform command substitution, which needs to know the parser
to use.
2019-05-04 19:30:00 -07:00
ridiculousfish
4ce485525e
Correct duplicate completion detection
...
Stop assuming that completions with the same hash are equal.
2019-05-04 18:35:22 -07:00
ridiculousfish
923a7ca0f0
Thread the parser into complete()
...
Eliminates uses of principal_parser
2019-05-04 18:17:18 -07:00
ridiculousfish
63bdc949ab
Make completion request flags an enum_set
2019-05-04 17:55:57 -07:00
ridiculousfish
4ff50eba41
Remove autoload_t, rename autoloader_t to autoload_t
...
Now that there are no more clients of autoload_t, delete it and
rename autoloader_t to autoload_t. Also clean up the headers.
2019-04-27 15:47:08 -07:00
ridiculousfish
68a28106b2
Reimplement completion autoloading via autoloader_t
...
This switches the completion autoloading machinery to autoloader_t.
2019-04-27 15:37:24 -07:00
ridiculousfish
6ec7c50ace
Stop removing functions and completions in autoload
...
autoloading has a "feature" where functions are removed in an LRU-fashion.
But there's hardly any benefit in removing autoloaded functions. Just stop
doing it.
2019-04-27 14:49:05 -07:00
David Gowers
38cadc9d4f
Variables as commands are in fact supported, eval docs should not claim otherwise. ( #5819 )
...
Provide an example that somewhat justifies eval's existence in light of this change.
Also correct similar misinformation found in a comment.
2019-04-26 15:30:13 +02:00
ridiculousfish
96bc8a14ca
Promote completion_mode_t to a real type
...
Eliminate big #defines like NO_COMMON.
2019-04-25 14:21:06 -07:00
ridiculousfish
496529b20a
Remove EXPAND prefix from expand_flags and lowercase them
2019-04-25 11:34:49 -07:00
ridiculousfish
d8ab6290e8
Switch expand_flags_t to enum_set
2019-04-25 11:23:03 -07:00
ridiculousfish
dcaac58f45
Rename expand_error_t to expand_result_t and make it class enum
...
Also lowercase it all.
2019-04-25 10:47:28 -07:00
ridiculousfish
2e119813e1
get_abbreviations to accept an environment_t
...
Now that we don't have dorky snapshotting, thread an dnvironment_t through
get_abbreviations. Removes a usage of env_stack_t::principal().
2019-04-16 22:27:01 -07:00
Mahmoud Al-Qudsi
e0e0fe9dd3
Re-implement eval
as a regular builtin
...
I did not realize builtins could safely call into the parser and inject
jobs during execution. This is much cleaner than hacking around the
required shape of a plain_statement.
2019-04-12 07:04:15 -05:00
Mahmoud Al-Qudsi
2fe2169065
Make eval
a decorator
...
`eval` has always been implemented as a function, which was always a bit
of a hack that caused some issues such as triggering the creation of a
new scope. This turns `eval` into a decorator.
The scoping issues with eval prevented it from being usable to actually
implement other shell components in fish script, such as the problems
described in #4442 , which should now no longer be the case.
Closes #4443 .
2019-04-11 10:36:49 -05:00
Mahmoud Al-Qudsi
0bda853dc7
Add detection of eval
to the parser
...
While `eval` is still a function, this paves the way for changing that
in the future, and lets the proc/exec functions detect when an eval is
used to allow/disallow certain behaviors and optimizations.
2019-04-10 21:19:57 -05:00
Aaron Gyes
b4ddd797e3
remove unused wcstring
2019-04-04 14:24:36 -07:00
Aaron Gyes
d837eee09d
remove some wcstring -> wchar_t* -> wcstring conversions
...
Mostly related to usage _(L"foo"), keeping in mind the _
macro does a wcstring().c_str() already.
And a smattering of other trivial micro-optimizations certain
to not help tangibly.
2019-03-14 15:21:08 -07:00
Aaron Gyes
d5ac239f68
This commit changes wchar.h includes to cwchar, and uses std::
...
for everything it provides.
2019-03-12 15:09:36 -07:00
ridiculousfish
dc27de8190
Rename reader_interrupted to reader_test_and_clear_interrupted
2019-03-02 15:17:00 -08:00
Fabian Homborg
ddfad001eb
Remove unnecessary string copy
...
This called function_exists_no_autoload with a c_str().
Only that takes a wcstring, so the constructor gets called which
copies that.
2019-02-04 17:10:53 +01:00
ridiculousfish
d3fa58d621
Cleanup common.h
...
Remove a bunch of headers, simplify lots of code, migrate it into .cpp files.
Debug build time improves by ~3 seconds on my Mac.
2019-02-03 18:22:38 -08:00
Dan Zimmerman
857561ca14
Fix warnings when compiling on macos
...
These warnings were appearing and annoying me so Im making a PR to fix
them.
2019-01-17 13:56:17 -06:00
Fabian Homborg
58b696bed1
complete: Don't allow wrapping a command with itself
...
Double-fixes #5541 , by not allowing it to happen.
2019-01-17 09:49:50 +01:00
ridiculousfish
3b1709180f
Instantize env_get
2019-01-10 20:07:53 -08:00
ridiculousfish
6f52e6bb1c
Instantize contents of exec.cpp and others
2019-01-10 20:07:47 -08:00
ridiculousfish
abcd24f716
Eliminate env_snapshot_t::current()
...
These uses are better served by passing in the real environment stack,
now that we have environment_t as a shared base class.
2019-01-10 20:07:14 -08:00
ridiculousfish
421fbdd52a
Instantize env_get_pwd_slash
...
This requires threading environment_t through many places, such as completions
and history. We introduce null_environment_t for when the environment isn't
important.
2019-01-10 20:01:28 -08:00
ridiculousfish
94adb53b1f
Eliminate complete_set_variable_names
2019-01-10 20:29:10 -08:00
ridiculousfish
e6b13c6bac
Begin to thread environments explicitly through completions
2019-01-10 20:29:10 -08:00
Mahmoud Al-Qudsi
bfe08a471d
Remove fish_mutex_t wrapper around std::mutex
...
@ridiculousfish had introduced this in 3a45cad12e
to work around an issue with Coverity Scan where it couldn't tell the
mutex was correctly locked, but even with the `fish_mutex_t` hack, it
still emits the same warnings, so there's no pointing in keeping it.
2018-12-30 20:37:36 -06:00
Fabian Homborg
7533fa89d4
complete: Stringify
2018-10-23 19:10:14 +02:00
ridiculousfish
202bf0bede
Tab complete abbreviations
...
This allows abbreviations to be expanded by tab completions.
Fixes #3233
2018-10-16 16:15:27 -07:00
ridiculousfish
161196fe53
Simplify wildcard_complete prototype
...
Rather than accepting both a 'description' and a 'description function',
accept just the description function.
2018-10-16 15:43:42 -07:00
ridiculousfish
90d89a3262
Use more move constructors in expansion
...
Reduce allocations by switching to move semantics.
clang-tidy detects some use-after-moves.
2018-10-11 02:03:28 -07:00
ridiculousfish
767b7a2180
Migrate the completion set to owning_lock_t
2018-10-05 09:05:59 -07:00