# 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](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.CodeAutocomplete/) ```csharp public class AutocompleteItem : IEquatable ``` ## Type Hierarchy - AutocompleteItem Current type - Implemented interfaces - [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1) ## Constructors `public AutocompleteItem(AutocompleteKind kind, Action log, ITypeSearcher typeSearcher)` Initializes a new instance of [AutocompleteItem](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.CodeAutocomplete/AutocompleteItem/). ### Parameters | Name | Type | Description | | --- | --- | --- | | `kind` | `AutocompleteKind` | Autocomplete item kind. | | `log` | `Action` | Logging callback used when completion building encounters non-fatal issues. | | `typeSearcher` | `ITypeSearcher` | Type searcher used to resolve CLR types. | ## Properties `[JsonProperty("kind")] [JsonPropertyName("kind")] public virtual AutocompleteKind Kind { get; set; }` Gets or sets the autocomplete item kind. `[JsonProperty("fullName")] [JsonPropertyName("fullName")] public virtual string FullName { get; set; }` Gets or sets the full name of the item, including namespace. `[JsonProperty("name")] [JsonPropertyName("name")] public virtual string Name { get; protected set; }` Gets the short item name without namespace. `[JsonProperty("type")] [JsonPropertyName("type")] public virtual string Type { get; protected set; }` Gets or sets the textual type for members and variables. `[JsonProperty("childs")] [JsonPropertyName("childs")] public virtual List Childs { get; protected set; }` Gets the child items for this autocomplete node. `[JsonProperty("parameters")] [JsonPropertyName("parameters")] public virtual List> Parameters { get; protected set; }` Gets method parameter overloads represented as lists of parameters. `[JsonProperty("typeArguments")] [JsonPropertyName("typeArguments")] public virtual List TypeArguments { get; protected set; }` Gets generic type arguments for variable usages. `[JsonProperty("typeParameters")] [JsonPropertyName("typeParameters")] public virtual List TypeParamenters { get; protected set; }` Gets generic type parameters defined by generic classes and structs. `protected AutocompleteItem[] ChildsNamespaceParts { get; }` Gets the namespace child items of this node. ## Methods `public static AutocompleteItem MakeRootWithTypes(Action log, ITypeSearcher typeSearcher)` Creates a root autocomplete item populated from all available types. ### Parameters | Name | Type | Description | | --- | --- | --- | | `log` | `Action` | Logging callback used when individual type processing fails. | | `typeSearcher` | `ITypeSearcher` | Type source used to discover all supported types. | ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | Root 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 | | --- | --- | | `Int32` | Number 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 | | --- | --- | | `String` | Textual 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 | | --- | --- | --- | | `instanceName` | `String` | Name to display for the new instance. | | `t` | `String` | Type name text. | `public void AddInstance(string instanceName, Type t, List typeArguments = null, bool loadExtraLevel = false)` Adds an instance item from a concrete CLR type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `instanceName` | `String` | Name to display for the new instance. | | `t` | `Type` | Type information for the instance. | | `typeArguments` | `List` | Optional generic type arguments. | | `loadExtraLevel` | `Boolean` | True to load this instance member list immediately. | `public HashSet Get(string pattern, IEnumerable usings, IEnumerable variables)` Searches descendants by pattern, namespace prefixes, and known variables. ### Parameters | Name | Type | Description | | --- | --- | --- | | `pattern` | `String` | Pattern to match against item names. | | `usings` | `IEnumerable` | Usings that are available in the search scope. | | `variables` | `IEnumerable` | Variable names available in scope. | ### Returns | Type | Description | | --- | --- | | `HashSet` | A set of matching autocomplete items. | `public void AddVariablesIfNotExists(IEnumerable variables)` Adds variable entries when a matching child item does not already exist. ### Parameters | Name | Type | Description | | --- | --- | --- | | `variables` | `IEnumerable` | Scope variables to add as framework members. | `protected IEnumerable AddRootUsing(IEnumerable usings)` Adds an empty namespace value so absolute and unqualified patterns are searchable. ### Parameters | Name | Type | Description | | --- | --- | --- | | `usings` | `IEnumerable` | Input using namespace collection. | ### Returns | Type | Description | | --- | --- | | `IEnumerable` | Normalized namespace list including the root entry. | `protected HashSet Search(IEnumerable patterns, IEnumerable allowVariables)` Searches children recursively by pre-split name patterns. ### Parameters | Name | Type | Description | | --- | --- | --- | | `patterns` | `IEnumerable` | Patterns where each entry is split into namespace/members. | | `allowVariables` | `IEnumerable` | Optional variable allow-list used at the last segment. | ### Returns | Type | Description | | --- | --- | | `HashSet` | Matched completion items. | `protected IEnumerable ProcessLastPattern(string p, IEnumerable allowVariables)` Resolves one final pattern segment and returns matching child items. ### Parameters | Name | Type | Description | | --- | --- | --- | | `p` | `String` | Last pattern token. | | `allowVariables` | `IEnumerable` | Optional variable allow-list. | ### Returns | Type | Description | | --- | --- | | `IEnumerable` | Matching completion item copies. | `protected AutocompleteItem MakeFieldsCopy()` Creates a shallow copy that contains only public metadata used for suggestion output. ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | A copied item for read access. | `public static string JoinNames(params string[] parts)` Concatenates name parts using a dot separator. ### Parameters | Name | Type | Description | | --- | --- | --- | | `parts` | `String[]` | Name segments. | ### Returns | Type | Description | | --- | --- | | `String` | Joined 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 | | --- | --- | --- | | `namespace` | `String` | Namespace path to add. | ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | Leaf namespace node. | `protected AutocompleteItem AddChildNamespaces(string prev, string[] parts)` Adds namespace nodes recursively for a split namespace path. ### Parameters | Name | Type | Description | | --- | --- | --- | | `prev` | `String` | Already built namespace prefix. | | `parts` | `String[]` | Remaining namespace parts. | ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | Leaf namespace node. | `protected AutocompleteItem SearchOrAddNamespacePart(string prev, string val)` Gets or creates a namespace node for a namespace segment. ### Parameters | Name | Type | Description | | --- | --- | --- | | `prev` | `String` | Current parent namespace. | | `val` | `String` | Current namespace segment. | ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | Existing or newly created namespace node. | `protected AutocompleteItem GetNamespacePart(string name)` Gets a namespace child with the specified name. ### Parameters | Name | Type | Description | | --- | --- | --- | | `name` | `String` | Namespace segment. | ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | Matching namespace node, or null if not found. | `protected AutocompleteItem MakeNamespacePart(string prev, string val)` Creates a namespace child node. ### Parameters | Name | Type | Description | | --- | --- | --- | | `prev` | `String` | Parent namespace string. | | `val` | `String` | Current namespace segment. | ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | Newly created namespace node. | `public void AddType(Type t)` Adds a type under its namespace and includes its static members. ### Parameters | Name | Type | Description | | --- | --- | --- | | `t` | `Type` | Type to add. | `protected AutocompleteItem AddTypeWithoutMembers(Type t)` Adds a class or struct item and returns the created node. ### Parameters | Name | Type | Description | | --- | --- | --- | | `t` | `Type` | Type to represent. | ### Returns | Type | Description | | --- | --- | | `AutocompleteItem` | Added type autocomplete item. | `protected void AddStaticMembers(Type t)` Adds public static members for the provided type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `t` | `Type` | Type to scan. | `protected void AddInstanceMembers(Type t, string varName)` Adds public instance members for the provided type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `t` | `Type` | Type to scan. | | `varName` | `String` | Instance 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 | | --- | --- | --- | | `t` | `Type` | Type to scan. | | `isStatic` | `Boolean` | Whether only static members are added. | | `variableName` | `String` | Instance name for non-static member prefixes. | ### Exceptions | Type | Description | | --- | --- | | `ArgumentException` | Thrown when `isStatic` and `variableName` are not consistent. | `protected void AddFields(Type t, BindingFlags flag, Func getName)` Adds public fields for the specified type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `t` | `Type` | Type to scan. | | `flag` | `BindingFlags` | Binding flags used to locate fields. | | `getName` | `Func` | Function that formats member names. | `protected void AddProperties(Type t, BindingFlags flag, Func getName)` Adds public properties for the specified type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `t` | `Type` | Type to scan. | | `flag` | `BindingFlags` | Binding flags used to locate properties. | | `getName` | `Func` | Function that formats member names. | `protected void AddMethodsAndEvents(Type t, BindingFlags flag, Func getName)` Adds public methods and extension methods, and events for the specified type. ### Parameters | Name | Type | Description | | --- | --- | --- | | `t` | `Type` | Type to scan. | | `flag` | `BindingFlags` | Binding flags used to locate methods and events. | | `getName` | `Func` | 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 | | --- | --- | --- | | `other` | `AutocompleteItem` | Item to compare. | ### Returns | Type | Description | | --- | --- | | `Boolean` | [true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) when full names are equal and current name is not blank. | `public override bool Equals(object obj)` ### Parameters | Name | Type | Description | | --- | --- | --- | | `obj` | `Object` | | ### Returns | Type | Description | | --- | --- | | `Boolean` | | `public override int GetHashCode()` Gets a hash code for this item based on [AutocompleteItem.FullName](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.CodeAutocomplete/AutocompleteItem/). ### Returns | Type | Description | | --- | --- | | `Int32` | Hash code value. | ## Fields `protected readonly object _addVariablesLock` Lock used to synchronize variable injection into child nodes. [Previous Year](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.Calendars/Year/) [Next AutocompleteKind](https://api.workflowengine.io/core/OptimaJet.Workflow.Core.Runtime.CodeAutocomplete/AutocompleteKind/)