FileSuggest
Extends
Type Parameters
• T
Properties
app
app:
App
Inherited from
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
isOpen
isOpen:
boolean
Whether the suggestion popup is currently open and visible
Inherited from
limit
limit:
number
Override this to use a different limit for suggestion items
Inherited from
scope
scope:
Scope
Inherited from
suggestEl
suggestEl:
HTMLElement
Suggestion container element
Inherited from
suggestions
suggestions:
SuggestionContainer
<T
>
Handles selection and rendering of the suggestions
Inherited from
suggestManager
suggestManager:
FileSuggestManager
Manages fetching of suggestions from metadatacache
Methods
close()
close():
void
Returns
void
Inherited from
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
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
open()
open():
void
Returns
void
Inherited from
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
showSuggestions()
showSuggestions(
results
):void
Parameters
• results: SearchResult
[]
Returns
void