EditorSuggest
Defined in: obsidian.d.ts:1328
Extends
Extended by
Type Parameters
• T
Constructors
new EditorSuggest()
new EditorSuggest<
T
>(app
):EditorSuggest
<T
>
Defined in: obsidian.d.ts:1342
Parameters
app
Returns
Overrides
Properties
app
app:
App
Defined in: obsidian.d.ts:3332
Inherited from
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.
isOpen
isOpen:
boolean
Defined in: src/obsidian/augmentations/PopoverSuggest.d.ts:10
Whether the suggestion popup is currently open and visible
Inherited from
limit
limit:
number
Defined in: obsidian.d.ts:1340
Override this to use a different limit for suggestion items
scope
scope:
Scope
Defined in: obsidian.d.ts:3334
Inherited from
suggestEl
suggestEl:
HTMLElement
Defined in: src/obsidian/augmentations/PopoverSuggest.d.ts:14
Suggestion container element
Inherited from
suggestions
suggestions:
SuggestionContainer
<T
>
Defined in: src/obsidian/augmentations/PopoverSuggest.d.ts:18
Handles selection and rendering of the suggestions
Inherited from
Methods
close()
close():
void
Defined in: obsidian.d.ts:3341
Returns
void
Inherited from
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
Returns
T
[] | Promise
<T
[]>
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
editor
file
null
| TFile
Returns
null
| EditorSuggestTriggerInfo
open()
open():
void
Defined in: obsidian.d.ts:3339
Returns
void
Inherited from
renderSuggestion()
abstract
renderSuggestion(value
,el
):void
Defined in: obsidian.d.ts:3347
Render the suggestion item into DOM.
Parameters
value
T
el
Returns
void
Inherited from
PopoverSuggest
.renderSuggestion
selectSuggestion()
abstract
selectSuggestion(value
,evt
):void
Defined in: obsidian.d.ts:3352
Called when the user makes a selection.
Parameters
value
T
evt
Returns
void
Inherited from
PopoverSuggest
.selectSuggestion
setInstructions()
setInstructions(
instructions
):void
Defined in: obsidian.d.ts:1346
Parameters
instructions
Returns
void
showSuggestions()
showSuggestions(
results
):void
Defined in: src/obsidian/augmentations/EditorSuggest.d.ts:6
Parameters
results
Returns
void