Class AutocompleteItem
OptimaJet.Workflow.Core.Runtime.CodeAutocomplete.AutocompleteItem
Represents a node in the autocomplete tree used by code completion.
Namespace: OptimaJet.Workflow.Core.Runtime.CodeAutocomplete
public class AutocompleteItem : IEquatable<AutocompleteItem>Inheritance
- Object
Implemented Interfaces
- System.IEquatable{OptimaJet.Workflow.Core.Runtime.CodeAutocomplete.AutocompleteItem}
Constructors
public AutocompleteItem(AutocompleteKind kind, Action<Exception, string> log, ITypeSearcher typeSearcher) #Initializes a new instance of AutocompleteItem.
Parameters
Name
Type
Description
kindAutocompleteKindAutocomplete item kind.
logAction<Exception, String>Logging callback used when completion building encounters non-fatal issues.
typeSearcherITypeSearcherType searcher used to resolve CLR types.
Properties
Name
Type
Kind #AutocompleteKindGets or sets the autocomplete item kind.
FullName #StringGets or sets the full name of the item, including namespace.
Name #StringGets the short item name without namespace.
Type #StringGets or sets the textual type for members and variables.
Childs #List<AutocompleteItem>Gets the child items for this autocomplete node.
Parameters #List<AutocompleteItem>Gets method parameter overloads represented as lists of parameters.
TypeArguments #List<String>Gets generic type arguments for variable usages.
TypeParamenters #List<String>Gets generic type parameters defined by generic classes and structs.
ChildsNamespaceParts #AutocompleteItem[]Gets the namespace child items of this node.
Methods
public static AutocompleteItem MakeRootWithTypes(Action<Exception, string> log, ITypeSearcher typeSearcher) #Creates a root autocomplete item populated from all available types.
Parameters
Name
Type
Description
logAction<Exception, String>Logging callback used when individual type processing fails.
typeSearcherITypeSearcherType source used to discover all supported types.
Returns
Type
Description
AutocompleteItemRoot autocomplete item containing the discovered namespace and type structure.
public int GetCount() #Gets the total number of nodes in this subtree, including this node.
Returns
Type
Description
Int32Number of nodes from this item down to leaves.
public override string ToString() #Gets a string that contains the item kind and full name.
Returns
Type
Description
StringTextual representation of the current autocomplete item.
public void AddInstance(string instanceName, string t) #Adds an instance item from a textual type description.
Parameters
Name
Type
Description
instanceNameStringName to display for the new instance.
tStringType name text.
public void AddInstance(string instanceName, Type t, List<string> typeArguments = null, bool loadExtraLevel = false) #Adds an instance item from a concrete CLR type.
Parameters
Name
Type
Description
instanceNameStringName to display for the new instance.
tTypeType information for the instance.
typeArgumentsList<String>Optional generic type arguments.
loadExtraLevelBooleanTrue to load this instance member list immediately.
public HashSet<AutocompleteItem> Get(string pattern, IEnumerable<string> usings, IEnumerable<AutocompleteVariable> variables) #Searches descendants by pattern, namespace prefixes, and known variables.
Parameters
Name
Type
Description
patternStringPattern to match against item names.
usingsIEnumerable<String>Usings that are available in the search scope.
variablesIEnumerable<AutocompleteVariable>Variable names available in scope.
Returns
Type
Description
HashSet<AutocompleteItem>A set of matching autocomplete items.
public void AddVariablesIfNotExists(IEnumerable<AutocompleteVariable> variables) #Adds variable entries when a matching child item does not already exist.
Parameters
Name
Type
Description
variablesIEnumerable<AutocompleteVariable>Scope variables to add as framework members.
protected IEnumerable<string> AddRootUsing(IEnumerable<string> usings) #Adds an empty namespace value so absolute and unqualified patterns are searchable.
Parameters
Name
Type
Description
usingsIEnumerable<String>Input using namespace collection.
Returns
Type
Description
IEnumerable<String>Normalized namespace list including the root entry.
protected HashSet<AutocompleteItem> Search(IEnumerable<string[]> patterns, IEnumerable<AutocompleteVariable> allowVariables) #Searches children recursively by pre-split name patterns.
Parameters
Name
Type
Description
patternsIEnumerable<String[]>Patterns where each entry is split into namespace/members.
allowVariablesIEnumerable<AutocompleteVariable>Optional variable allow-list used at the last segment.
Returns
Type
Description
HashSet<AutocompleteItem>Matched completion items.
protected IEnumerable<AutocompleteItem> ProcessLastPattern(string p, IEnumerable<AutocompleteVariable> allowVariables) #Resolves one final pattern segment and returns matching child items.
Parameters
Name
Type
Description
pStringLast pattern token.
allowVariablesIEnumerable<AutocompleteVariable>Optional variable allow-list.
Returns
Type
Description
IEnumerable<AutocompleteItem>Matching completion item copies.
protected AutocompleteItem MakeFieldsCopy() #Creates a shallow copy that contains only public metadata used for suggestion output.
Returns
Type
Description
AutocompleteItemA copied item for read access.
public static string JoinNames(params string[] parts) #Concatenates name parts using a dot separator.
Parameters
Name
Type
Description
partsString[]Name segments.
Returns
Type
Description
StringJoined value for namespace-style names.
protected AutocompleteItem AddChildNamespaces(string @namespace) #Ensures namespace nodes for all segments in a full namespace name.
Parameters
Name
Type
Description
namespaceStringNamespace path to add.
Returns
Type
Description
AutocompleteItemLeaf namespace node.
protected AutocompleteItem AddChildNamespaces(string prev, string[] parts) #Adds namespace nodes recursively for a split namespace path.
Parameters
Name
Type
Description
prevStringAlready built namespace prefix.
partsString[]Remaining namespace parts.
Returns
Type
Description
AutocompleteItemLeaf namespace node.
protected AutocompleteItem SearchOrAddNamespacePart(string prev, string val) #Gets or creates a namespace node for a namespace segment.
Parameters
Name
Type
Description
prevStringCurrent parent namespace.
valStringCurrent namespace segment.
Returns
Type
Description
AutocompleteItemExisting or newly created namespace node.
protected AutocompleteItem GetNamespacePart(string name) #Gets a namespace child with the specified name.
Parameters
Name
Type
Description
nameStringNamespace segment.
Returns
Type
Description
AutocompleteItemMatching namespace node, or null if not found.
protected AutocompleteItem MakeNamespacePart(string prev, string val) #Creates a namespace child node.
Parameters
Name
Type
Description
prevStringParent namespace string.
valStringCurrent namespace segment.
Returns
Type
Description
AutocompleteItemNewly created namespace node.
public void AddType(Type t) #Adds a type under its namespace and includes its static members.
Parameters
Name
Type
Description
tTypeType to add.
protected AutocompleteItem AddTypeWithoutMembers(Type t) #Adds a class or struct item and returns the created node.
Parameters
Name
Type
Description
tTypeType to represent.
Returns
Type
Description
AutocompleteItemAdded type autocomplete item.
protected void AddStaticMembers(Type t) #Adds public static members for the provided type.
Parameters
Name
Type
Description
tTypeType to scan.
protected void AddInstanceMembers(Type t, string varName) #Adds public instance members for the provided type.
Parameters
Name
Type
Description
tTypeType to scan.
varNameStringInstance variable name used when naming members.
protected void AddMembers(Type t, bool isStatic, string variableName) #Adds public members and methods as child autocomplete entries.
Parameters
Name
Type
Description
tTypeType to scan.
isStaticBooleanWhether only static members are added.
variableNameStringInstance name for non-static member prefixes.
protected void AddFields(Type t, BindingFlags flag, Func<string, string> getName) #Adds public fields for the specified type.
Parameters
Name
Type
Description
tTypeType to scan.
flagBindingFlagsBinding flags used to locate fields.
getNameFunc<String, String>Function that formats member names.
protected void AddProperties(Type t, BindingFlags flag, Func<string, string> getName) #Adds public properties for the specified type.
Parameters
Name
Type
Description
tTypeType to scan.
flagBindingFlagsBinding flags used to locate properties.
getNameFunc<String, String>Function that formats member names.
protected void AddMethodsAndEvents(Type t, BindingFlags flag, Func<string, string> getName) #Adds public methods and extension methods, and events for the specified type.
Parameters
Name
Type
Description
tTypeType to scan.
flagBindingFlagsBinding flags used to locate methods and events.
getNameFunc<String, String>Function that formats member names.
public bool Equals(AutocompleteItem other) #Determines whether this item is the same as another by matching full name.
Parameters
Name
Type
Description
otherAutocompleteItemItem to compare.
Returns
Type
Description
Booleantrue when full names are equal and current name is not blank.
public override bool Equals(object obj) #Parameters
Name
Type
Description
objObjectReturns
Type
Description
Booleanpublic override int GetHashCode() #Gets a hash code for this item based on AutocompleteItem.FullName.
Returns
Type
Description
Int32Hash code value.
Fields
protected readonly object _addVariablesLock #Lock used to synchronize variable injection into child nodes.