Skip to content

FileSuggest

Defined in: src/obsidian/internals/FileSuggest.d.ts:6

Extends

Type Parameters

T

Properties

app

app: App

Defined in: obsidian.d.ts:3332

Inherited from

EditorSuggest.app


context

context: null | EditorSuggestContext

Defined in: obsidian.d.ts:1335

Current suggestion context, containing the result of onTrigger. This will be null any time the EditorSuggest is not supposed to run.

Inherited from

EditorSuggest.context


isOpen

isOpen: boolean

Defined in: src/obsidian/augmentations/PopoverSuggest.d.ts:10

Whether the suggestion popup is currently open and visible

Inherited from

EditorSuggest.isOpen


limit

limit: number

Defined in: obsidian.d.ts:1340

Override this to use a different limit for suggestion items

Inherited from

EditorSuggest.limit


scope

scope: Scope

Defined in: obsidian.d.ts:3334

Inherited from

EditorSuggest.scope


suggestEl

suggestEl: HTMLElement

Defined in: src/obsidian/augmentations/PopoverSuggest.d.ts:14

Suggestion container element

Inherited from

EditorSuggest.suggestEl


suggestions

suggestions: SuggestionContainer<T>

Defined in: src/obsidian/augmentations/PopoverSuggest.d.ts:18

Handles selection and rendering of the suggestions

Inherited from

EditorSuggest.suggestions


suggestManager

suggestManager: FileSuggestManager

Defined in: src/obsidian/internals/FileSuggest.d.ts:10

Manages fetching of suggestions from metadatacache

Methods

close()

close(): void

Defined in: obsidian.d.ts:3341

Returns

void

Inherited from

EditorSuggest.close


getSuggestions()

abstract getSuggestions(context): T[] | Promise<T[]>

Defined in: obsidian.d.ts:1363

Generate suggestion items based on this context. Can be async, but preferably sync. When generating async suggestions, you should pass the context along.

Parameters

context

EditorSuggestContext

Returns

T[] | Promise<T[]>

Inherited from

EditorSuggest.getSuggestions


onTrigger()

abstract onTrigger(cursor, editor, file): null | EditorSuggestTriggerInfo

Defined in: obsidian.d.ts:1357

Based on the editor line and cursor position, determine if this EditorSuggest should be triggered at this moment. Typically, you would run a regular expression on the current line text before the cursor. Return null to indicate that this editor suggest is not supposed to be triggered.

Please be mindful of performance when implementing this function, as it will be triggered very often (on each keypress). Keep it simple, and return null as early as possible if you determine that it is not the right time.

Parameters

cursor

EditorPosition

editor

Editor

file

null | TFile

Returns

null | EditorSuggestTriggerInfo

Inherited from

EditorSuggest.onTrigger


open()

open(): void

Defined in: obsidian.d.ts:3339

Returns

void

Inherited from

EditorSuggest.open


renderSuggestion()

abstract renderSuggestion(value, el): void

Defined in: obsidian.d.ts:3347

Render the suggestion item into DOM.

Parameters

value

T

el

HTMLElement

Returns

void

Inherited from

EditorSuggest.renderSuggestion


selectSuggestion()

abstract selectSuggestion(value, evt): void

Defined in: obsidian.d.ts:3352

Called when the user makes a selection.

Parameters

value

T

evt

MouseEvent | KeyboardEvent

Returns

void

Inherited from

EditorSuggest.selectSuggestion


setInstructions()

setInstructions(instructions): void

Defined in: obsidian.d.ts:1346

Parameters

instructions

Instruction[]

Returns

void

Inherited from

EditorSuggest.setInstructions


showSuggestions()

showSuggestions(results): void

Defined in: src/obsidian/augmentations/EditorSuggest.d.ts:6

Parameters

results

SearchResult[]

Returns

void

Inherited from

EditorSuggest.showSuggestions