EditorSuggest\<T\>
Abstract Class: EditorSuggest<T>
Section titled “Abstract Class: EditorSuggest<T>”Defined in: suggest.ts:540
Base class for adding a type-ahead popover.
Extends
Section titled “Extends”Type Parameters
Section titled “Type Parameters”T
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EditorSuggest<
T>(app):EditorSuggest<T>
Defined in: suggest.ts:559
Parameters
Section titled “Parameters”Returns
Section titled “Returns”EditorSuggest<T>
Overrides
Section titled “Overrides”Properties
Section titled “Properties”
readonlyapp:App
Defined in: suggest.ts:39
Inherited from
Section titled “Inherited from”context
Section titled “context”context:
EditorSuggestContext|null=null
Defined in: suggest.ts:547
Current suggestion context, containing the result of onTrigger. This will
be null any time the EditorSuggest is not supposed to run.
limit:
number=-1
Defined in: suggest.ts:557
Override this to use a different limit for suggestion items
scope:
Scope
Defined in: suggest.ts:549
Overrides
Section titled “Overrides”suggestEl
Section titled “suggestEl”suggestEl:
HTMLElement
Defined in: suggest.ts:550
Methods
Section titled “Methods”close()
Section titled “close()”close():
void
Defined in: suggest.ts:566
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”getSuggestions()
Section titled “getSuggestions()”
abstractgetSuggestions(context):T[] |Promise<T[]>
Defined in: suggest.ts:600
Generate suggestion items based on this context. Can be async, but preferably sync. When generating async suggestions, you should pass the context along.
Parameters
Section titled “Parameters”context
Section titled “context”Returns
Section titled “Returns”T[] | Promise<T[]>
onTrigger()
Section titled “onTrigger()”
abstractonTrigger(cursor,editor,file):EditorSuggestTriggerInfo|null
Defined in: suggest.ts:588
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
Section titled “Parameters”cursor
Section titled “cursor”editor
Section titled “editor”TFile | null
Returns
Section titled “Returns”EditorSuggestTriggerInfo | null
open()
Section titled “open()”open():
void
Defined in: suggest.ts:571
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”renderSuggestion()
Section titled “renderSuggestion()”
abstractrenderSuggestion(value,el):void
Defined in: suggest.ts:53
Parameters
Section titled “Parameters”T
HTMLElement
Returns
Section titled “Returns”void
Inherit Doc
Section titled “Inherit Doc”Inherited from
Section titled “Inherited from”PopoverSuggest.renderSuggestion
selectSuggestion()
Section titled “selectSuggestion()”
abstractselectSuggestion(value,evt):void
Defined in: suggest.ts:58
Parameters
Section titled “Parameters”T
MouseEvent | KeyboardEvent
Returns
Section titled “Returns”void
Inherit Doc
Section titled “Inherit Doc”Inherited from
Section titled “Inherited from”PopoverSuggest.selectSuggestion
setInstructions()
Section titled “setInstructions()”setInstructions(
instructions):void
Defined in: suggest.ts:564
Parameters
Section titled “Parameters”instructions
Section titled “instructions”Instruction[]
Returns
Section titled “Returns”void