Skip to content

obsidian/case-insensitive-file-index

Provides an opt-in O(1) case-insensitive resolver for Obsidian vaults.

Obsidian’s native Vault resolves a string path case-insensitively (the Windows/macOS default) in O(1) on a hit but with an O(vault) scan on a miss. The miss case is the hot one during deletion cascades, where extension checks and cache lookups are performed on already-removed paths. This module backs the case-insensitive lookup with a lowercase-path → TAbstractFile index so misses are O(1) too.

The index is explicitly opt-in: a consumer installs it by loading a Component that keeps it in sync with create/delete/rename events (see CaseInsensitiveFileIndexComponent). Until then, the resolution layer falls back to the native (O(vault)-on-miss) lookup, so behavior is unchanged.

ClassDescription
CaseInsensitiveFileIndexAn O(1) case-insensitive index of the loaded files and folders of a single vault. The index maps the lowercased path of each abstract file to the abstract file itself. It is kept in sync by an owning component that forwards create/delete/rename vault events.
FunctionDescription
getCaseInsensitiveFileIndexRetrieves the installed case-insensitive file index for the given application, if any.
setCaseInsensitiveFileIndexInstalls a case-insensitive file index as the active resolver.
unsetCaseInsensitiveFileIndexUninstalls a case-insensitive file index, but only if it is the currently-installed one.