Workflow Engine .NET

Assembly: OptimaJet.Workflow.Core

Class AutocompleteItem

OptimaJet.Workflow.Core.Runtime.CodeAutocomplete.AutocompleteItem

Represents a node in the autocomplete tree used by code completion.

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
kind
AutocompleteKind
Autocomplete item kind.
log
Action<Exception, String>
Logging callback used when completion building encounters non-fatal issues.
typeSearcher
ITypeSearcher
Type searcher used to resolve CLR types.

Properties

Name
Type
Kind #
AutocompleteKind
Gets or sets the autocomplete item kind.
FullName #
String
Gets or sets the full name of the item, including namespace.
Name #
String
Gets the short item name without namespace.
Type #
String
Gets 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
log
Action<Exception, String>
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<string> 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<String>
Optional generic type arguments.
loadExtraLevel
Boolean
True 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
pattern
String
Pattern to match against item names.
usings
IEnumerable<String>
Usings that are available in the search scope.
variables
IEnumerable<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
variables
IEnumerable<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
usings
IEnumerable<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
patterns
IEnumerable<String[]>
Patterns where each entry is split into namespace/members.
allowVariables
IEnumerable<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
p
String
Last pattern token.
allowVariables
IEnumerable<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
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.
protected void AddFields(Type t, BindingFlags flag, Func<string, string> 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<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
t
Type
Type to scan.
flag
BindingFlags
Binding flags used to locate properties.
getName
Func<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
t
Type
Type to scan.
flag
BindingFlags
Binding flags used to locate methods and events.
getName
Func<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
other
AutocompleteItem
Item to compare.

Returns

Type
Description
Boolean
true 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.

Returns

Type
Description
Int32
Hash code value.

Fields

protected readonly object _addVariablesLock #
Lock used to synchronize variable injection into child nodes.