mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 18:21:45 +08:00
Stop calling path_get_path for builtins and functions
highlight.cpp was blindly calling path_get_path for each head command typed at the prompt which triggers a lot of syscalls via waccess. It's still going to do that while commands are being composed, but now it won't if we can make a cheap lookup to the builtins/functions hash table and can determine that it's a valid command before inspecting the filesystem.
This commit is contained in:
parent
3319e308d0
commit
73bf9dd784
|
@ -453,12 +453,9 @@ bool autosuggest_validate_from_history(const history_item_t &item,
|
|||
}
|
||||
|
||||
// Not handled specially so handle it here.
|
||||
bool cmd_ok = false;
|
||||
if (path_get_path(parsed_command, nullptr, ctx.vars)) {
|
||||
cmd_ok = true;
|
||||
} else if (builtin_exists(parsed_command) || function_exists_no_autoload(parsed_command)) {
|
||||
cmd_ok = true;
|
||||
}
|
||||
bool cmd_ok = builtin_exists(parsed_command)
|
||||
|| function_exists_no_autoload(parsed_command)
|
||||
|| path_get_path(parsed_command, nullptr, ctx.vars);
|
||||
|
||||
if (cmd_ok) {
|
||||
const path_list_t &paths = item.get_required_paths();
|
||||
|
|
Loading…
Reference in New Issue
Block a user