Skip to content

FileSuggest

Extends

Type Parameters

T

Properties

app

app: App

Inherited from

EditorSuggest.app


context

context: null | EditorSuggestContext

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

Whether the suggestion popup is currently open and visible

Inherited from

EditorSuggest.isOpen


limit

limit: number

Override this to use a different limit for suggestion items

Inherited from

EditorSuggest.limit


scope

scope: Scope

Inherited from

EditorSuggest.scope


suggestEl

suggestEl: HTMLElement

Suggestion container element

Inherited from

EditorSuggest.suggestEl


suggestions

suggestions: SuggestionContainer<T>

Handles selection and rendering of the suggestions

Inherited from

EditorSuggest.suggestions


suggestManager

suggestManager: FileSuggestManager

Manages fetching of suggestions from metadatacache

Methods

close()

close(): void

Returns

void

Inherited from

EditorSuggest.close


getSuggestions()

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

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

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

Returns

void

Inherited from

EditorSuggest.open


renderSuggestion()

abstract renderSuggestion(value, el): void

Render the suggestion item into DOM.

Parameters

value: T

el: HTMLElement

Returns

void

Inherited from

EditorSuggest.renderSuggestion


selectSuggestion()

abstract selectSuggestion(value, evt): void

Called when the user makes a selection.

Parameters

value: T

evt: MouseEvent | KeyboardEvent

Returns

void

Inherited from

EditorSuggest.selectSuggestion


setInstructions()

setInstructions(instructions): void

Parameters

instructions: Instruction[]

Returns

void

Inherited from

EditorSuggest.setInstructions


showSuggestions()

showSuggestions(results): void

Parameters

results: SearchResult[]

Returns

void

Inherited from

EditorSuggest.showSuggestions