-
-
Notifications
You must be signed in to change notification settings - Fork 3
Architecture
Λlisue edited this page Nov 17, 2024
·
12 revisions
Fall decomposes the functionality of a Fuzzy Finder into the following modules:
Name | Description |
---|---|
Coordinator | A module that determines the style and layout of the picker. |
Theme | A theme structure used to define the style of the picker. |
Source | Retrieves data from arbitrary sources and generates an AsyncIterableIterator of items. |
Matcher | Filters the AsyncIterableIterator received from the Source based on user input. |
Curator | Combines Source and Matcher, performing data retrieval and filtering based on user input. |
Sorter | Sorts items received from the Matcher or Curator. |
Renderer | Processes sorted items from the Sorter for user display. |
Previewer | Generates content for previewing the currently selected item. |
Action | Executes actions on the selected target item. |
Refiner | Applies to Source or Curator to refine and process generated items. |
In addition, Fall provides the following functions to refine and compose individual modules:
Name | Description |
---|---|
refineSource |
Applies multiple Refiners to Source to refine and process generated items. |
refineCurator |
Applies multiple Refiners to Curator to refine and process generated items. |
composeSources |
Combines multiple Sources to create a new Source that sequentially retrieves items from all Sources. |
composeMatchers |
Combines multiple Matchers to create a new Matcher that filters items through all Matchers. |
composeCurators |
Combines multiple Curators to create a new Curator that retrieves items through all Curators. |
composeSorters |
Combines multiple Sorters to create a new Sorter that sorts items through all Sorters. |
composeRenderers |
Combines multiple Renderers to create a new Renderer that processes items through all Renderers. |
composePreviewers |
Combines multiple Previewers to create a new Previewer that generates content from any of the Previewers. |
composeActions |
Combines multiple Actions to create a new Action that invokes all Actions. |
By combining these modules, Fall enables flexible functionality.
For example, the following code demonstrates how to create a Source that retrieves files recorded in Vim’s oldfiles that exist in the current directory:
import { refineSource } from "jsr:@vim-fall/std"
import * as builtin from "jsr:@vim-fall/std/builtin"
const source = refineSource(
builtin.source.oldfiles,
builtin.refiner.exists,
builtin.refiner.cwd,
);
Similarly, the following example shows how to create an Action that change directory and open.
import { composeActions } from "jsr:@vim-fall/std"
import * as builtin from "jsr:@vim-fall/std/builtin"
const action = composeActions(
builtin.action.cd,
builtin.action.open,
);