Class LibraryPromptAssist

java.lang.Object
com.inductiveautomation.ignition.designer.ai.embed.LibraryPromptAssist
All Implemented Interfaces:
PromptAssist
Direct Known Subclasses:
SystemLibraryPromptAssist, UserLibraryPromptAssist

public abstract class LibraryPromptAssist extends Object implements PromptAssist
Base class for PromptAssists that browse a ScriptLibrary — a dotted-path tree of script symbols — through the @-popup. Leaves render as PromptAssist.Option.Insert rows whose body carries the symbol's rendered documentation. MODULE-kind branches render as PromptAssist.Option.InsertOrDrillIn rows: confirming references the package as a whole (a body listing its direct members), expanding browses into it. Rows are ranked like the Ctrl+Space autocomplete popup.

Package references are one level deep. A nested package appears in its parent's body as a name, not as its own members, so referencing a.b never drags in a.b.c's contents — the user references a.b.c directly to see inside it.

  • Constructor Details

  • Method Details

    • id

      public final String id()
      Specified by:
      id in interface PromptAssist
      Returns:
      the machine identifier owning this assist's @<id>: token namespace. Lowercase [a-z0-9-]+, short (e.g. "tag", "opc").
      See Also:
    • label

      public final String label()
      Specified by:
      label in interface PromptAssist
      Returns:
      a short friendly label for this assist to show in the UI.
    • separator

      public String separator()
      Description copied from interface: PromptAssist
      Separator the embedded controller places between this assist's PromptAssist.label() and its query when building the routing prefix, and that the assist itself should use inside its PromptAssist.Option.DrillIn.nextQuery values.

      Default is "/".

      Specified by:
      separator in interface PromptAssist
      Returns:
      a non-empty separator string the controller uses both to recognize the routing prefix this assist owns and to re-prefix child PromptAssist.Option.DrillIns on the way back out.
    • options

      public final CompletableFuture<List<PromptAssist.Option>> options(String query)
      Description copied from interface: PromptAssist
      Fetch the rows to show for query.
      Specified by:
      options in interface PromptAssist
      Parameters:
      query - the text the user has typed past the trigger character, or the PromptAssist.Option.DrillIn.nextQuery of a row the user just selected. Empty when the user has just typed the trigger and has not yet typed anything else.
      Returns:
      the rows to render. The framework discards stale results silently, so an implementation that completes after a newer query has been issued does not need to special-case the race.
    • library

      protected abstract ScriptLibrary library()
      The library this assist browses. Called on every options(String) invocation, off the EDT; a ScriptLibrary is a cheap fixed view, so implementations build one against their source's current state per call.
    • drillInDetail

      protected String drillInDetail(String path)
      Detail label for a MODULE-kind row addressing path, also carried as its reference body's Kind: field. "package" unless overridden; the full dotted path is supplied so an override can consult project state (e.g. distinguishing script modules from grouping folders).
    • callablePath

      protected String callablePath(String path)
      Maps a browse path to the fully-qualified name a script invokes the symbol by, carried in the insert body's Path: field. Identity by default; override when the library is browsed relative to an implicit root.
    • packageDocumentation

      protected @Nullable String packageDocumentation(com.inductiveautomation.ignition.common.script.typing.CompletionDescriptor descriptor)
      The package's own documentation, carried in a package reference body's Documentation: field. The descriptor's computed description by default; return null to omit the field, as a library whose package descriptors carry synthetic text should.