VisionSystemsInc / VisionSystemsInc/vsi_common
Tab completion slow
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 8
- Forks
- 9
- Avg merge
- 36m
- Merged PRs (30d)
- 1
Description
Problem
Tab completion is getting really slow on projects of decent size. I was able to track it down to the _just_load_justfile call. This is where everything is loaded so that plugins can be discovered, and parsed. The timing for this call can be emulated via:
$ time bash -ic ". setup.env; . external/vsi_common/linux/source_once.bsh; _just_load_justfile Justfile"
real 0m4.014s
user 0m2.723s
sys 0m1.296s
This is because, source_once is disabled (by design) in interactive mode:
$ time bash -c ". setup.env; . external/vsi_common/linux/source_once.bsh; _just_load_justfile Justfile"
real 0m0.316s
user 0m0.220s
sys 0m0.105s
Possible Solutions:
- Add an additional flag, so that tab complete can run in a subshell, and go ahead and use source_once
if [[ $- != *i* -o ${JUST_SOURCE_ONCE} = 0 ]]; then
source_once &> /dev/null && return 0
fi
- Come up with a new way to discover plugins. Forcing the use of
JUST_PLUGIN_FILEcould work here, but would involve multiple steps of refactoring:- Add a check into all plugins, that error out if they aren't being sourced from _just_get_plugins (a simple check gate for a private variable would be good enough)
- All projects would need to be updated to use this
- Dev would have to get used to this
Option 2 does have the advantage that potentially even faster tab completion could be accomplished, eventually on windows too.
Ideas? @scott-vsi @drewgilliam
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the timing with the provided bash command, then inspect _just_load_justfile, external/vsi_common/linux/source_once.bsh, and the _just_get_plugins/JUST_PLUGIN_FILE paths mentioned in the issue. Compare the proposed approaches and define done as faster tab completion while preserving plugin discovery and existing interactive behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, shell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100