Skip to main content

api.dictionary

Interface: IDictionaryApi

Implementation tier: T1 (reads) / T2 (provider, iterate)

Look up dictionary entries, search dictionaries, list modules, iterate entries, and register custom dictionary providers.

Permissions

  • dictionary:read
  • dictionary:provide (for registerProvider)

Methods

listModules

listModules(): Promise<DictionaryModuleInfoDto[]>

Returns: Promise<DictionaryModuleInfoDto[]>


lookup

lookup(moduleId: string, key: string): Promise<DictionaryEntryDto | null>

Look up a single entry by its key (Strong's number, lemma, or headword).

Parameters:

NameTypeRequiredDescription
moduleIdstringYes
keystringYes

Returns: Promise<DictionaryEntryDto | null>


search(
moduleId: string,
query: string,
opts?: { limit?: number },
): Promise<DictionaryEntryDto[]>

Free-text search.

Parameters:

NameTypeRequiredDescription
moduleIdstringYes
querystringYes
opts{ limit?: number }No

Returns: Promise<DictionaryEntryDto[]>


iterateEntries

iterateEntries(opts: IterateDictionaryOpts): Promise<DictionaryIterationResult>

Cursor-based iteration over all entries.

Parameters:

NameTypeRequiredDescription
optsIterateDictionaryOptsYes

Returns: Promise<DictionaryIterationResult>


registerProvider

registerProvider(provider: DictionaryProviderDescriptor): Promise<DisposableHandle>

Register a custom dictionary provider — e.g. a paid lexicon, an online API, or a richer Greek/Hebrew lookup with stemming and morphology data.

Parameters:

NameTypeRequiredDescription
providerDictionaryProviderDescriptorYes

Returns: Promise<DisposableHandle>


Events

onDidChangeActiveDictionary

onDidChangeActiveDictionary: IEventApi<{ moduleId: string } | null>

Payload type: { moduleId: string } | null

Subscribe to this event:

const handle = await api.dictionary.onDidChangeActiveDictionary.subscribe((payload) => {
// Handle event
});

// Later, to unsubscribe:
await handle.dispose();