This changeset allows users to configure a list of scanners to try in order, like
let g:CommandTFileScanner = ['watchman', 'git', 'find', 'ruby']
by providing a composite file scanner that has a list of scanners it delegates to.
Configuring a single value is still supported so we don’t break users’ configuration.
This also allows us to drop the hardcoded fallback mechanisms used by the watchman and git scanners.
Some open points:
[ ] Is this even something we want?
[ ] Add/Change the documentation
[ ] Add tests
[ ] Consider a new default value? (['git', 'find', 'ruby'] seems safe)
[ ] Handle configuration problems gracefully
[ ] Improve looping code in the composite scanner
(mkhl/simplify-composite seems simpler but doesn’t raise when all scanners fail)
[ ] Improve control flow in/to the composite scanner
(we currently just silently skip scanners that raise RuntimeError or ENOENT)
[ ] Do something with caching?
(This leaves it in the actual scanners, we could pull it up into the composite, or into a whole separate layer.)
Note: This is a work in progress!
This changeset allows users to configure a list of scanners to try in order, like
by providing a composite file scanner that has a list of scanners it delegates to. Configuring a single value is still supported so we don’t break users’ configuration.
This also allows us to drop the hardcoded fallback mechanisms used by the
watchman
andgit
scanners.Some open points:
['git', 'find', 'ruby']
seems safe)