Class CodeAutocompleteProvider
OptimaJet.Workflow.Core.Runtime.CodeAutocomplete.CodeAutocompleteProvider
Aggregates, stores, and routes autocomplete requests to ICodeAutocompleter implementations.
Namespace: OptimaJet.Workflow.Core.Runtime.CodeAutocomplete
public class CodeAutocompleteProvider : ICodeAutocompleteProviderType Hierarchy
- CodeAutocompleteProvider Current type
- Implemented interfaces
Constructors
public CodeAutocompleteProvider(Func<ILogger> getLogger, bool allowParallel = true, bool supressAutoAddDefaultAutocompleter = false, params ICodeAutocompleter[] autocompleters) #Initializes a new CodeAutocompleteProvider with optional custom autocompleters.
Parameters
Name
Type
Description
getLoggerFunc<ILogger>A factory that returns a logger instance for diagnostics.
allowParallelBooleantrue to use parallel enumeration when configuring and iterating autocompleters; otherwise false.supressAutoAddDefaultAutocompleterBooleanWhen
false, this provider adds DefaultAutocompleter if a default implementation is not supplied.autocompletersICodeAutocompleter[]Custom autocompleters to register.
public CodeAutocompleteProvider(Func<ILogger> logger) #Initializes a new CodeAutocompleteProvider with parallel behavior and default autocompleter setup.
Parameters
Name
Type
Description
loggerFunc<ILogger>A factory that returns a logger instance for diagnostics.
public CodeAutocompleteProvider(Func<ILogger> logger, params ICodeAutocompleter[] autocompleters) #Initializes a new CodeAutocompleteProvider with custom autocompleters.
Parameters
Name
Type
Description
loggerFunc<ILogger>A factory that returns a logger instance for diagnostics.
autocompletersICodeAutocompleter[]Custom autocompleters to register.
Properties
protected Action<Exception, string> Log { get; } #Gets a callback that logs exceptions with both tracing and optional logger infrastructure.
Methods
public virtual void RunInitTask() #Starts asynchronous initialization of all autocompleters that are not initialized.
public virtual void InitCodeAutocomletersThatNoInitialized() #Initializes all configured autocompleters that have not been initialized yet.
Remarks
Exceptions from individual autocompleters are logged and do not stop initializing the remaining providers.
public virtual void RegisterCodeAutocompleters(params ICodeAutocompleter[] completers) #Adds custom autocompleters to the provider without initializing them.
Parameters
Name
Type
Description
completersICodeAutocompleter[]Autocompleter instances to append.
Remarks
Passing
null for completers is ignored.public virtual void AddVariablesToDefaultCompleterIfEnable(IEnumerable<AutocompleteVariable> variables) #Adds variables to the DefaultAutocompleter when it is present.
Parameters
Name
Type
Description
variablesIEnumerable<AutocompleteVariable>Variables to add to the default autocompleter.
Remarks
If the default autocompleter is not configured, no action is taken. If the default autocompleter has not been initialized, it is initialized first.
public virtual void AddVariablesToDefaultCompleterIfEnable(string varName, Type varType) #Adds a single variable definition to the DefaultAutocompleter when it is present.
Parameters
Name
Type
Description
varNameStringVariable name used for autocomplete.
Remarks
If the default autocompleter is not configured, no action is taken. If the default autocompleter has not been initialized, it is initialized first.
public virtual HashSet<AutocompleteItem> Get(string pattern, IEnumerable<string> usings, IEnumerable<AutocompleteVariable> variables) #Gets autocomplete suggestions from all configured and already initialized autocompleters.
Parameters
Name
Type
Description
patternStringText to match, for example,
System.Thr.usingsIEnumerable<String>Usings in scope, for example,
System or System.Threading.variablesIEnumerable<AutocompleteVariable>Variables that can be used in autocomplete.
Returns
Type
Description
HashSet<AutocompleteItem>A distinct set of matching AutocompleteItem values.
Remarks
Errors from individual autocompleters are logged and do not prevent collecting results from others.
protected virtual IEnumerable<ICodeAutocompleter> UseParallelOption(bool allowParallel, IEnumerable<ICodeAutocompleter> autocompleters) #Applies the provider's parallel execution setting to the autocompleter sequence.
Parameters
Name
Type
Description
allowParallelBooleantrue to return a parallel sequence; otherwise returns the source sequence as-is.autocompletersIEnumerable<ICodeAutocompleter>The source autocompleters.
Returns
Type
Description
IEnumerable<ICodeAutocompleter>An enumerable view of autocompleters used by this provider.
Fields
protected IEnumerable<ICodeAutocompleter> _autocompleters #Registered autocompleters used by this provider.
protected readonly Func<ILogger> _getLogger #Factory used to create logger instances for diagnostics.
protected readonly bool _allowParallel #Indicates whether autocompleter enumeration should be prepared for parallel execution.