Beispiel #1
0
        /// <summary>
        /// This updates the known intellisense to include defined variables.
        /// </summary>
        /// <param name="vars"></param>
        /// <returns></returns>
        private IntellisenseEntry CreateUpdatedIntellisense(IEnumerable <ModelItem> vars)
        {
            IntellisenseEntry tn = new IntellisenseEntry();

            tn.Children.AddRange(_intellisenseData.Result.Children);

            lock (_guard)
            {
                int count = 0;
                foreach (var vs in vars)
                {
                    var vsProp = vs.Properties["Name"];
                    if (vsProp == null)
                    {
                        continue;
                    }

                    var varName = vsProp.ComputedValue as String;
                    var res     = tn.Children.Where(x => x.Name == varName).ToList();
                    if (res.Count == 0)
                    {
                        Type sysType     = null;
                        var  sysTypeProp = vs.Properties["Type"];
                        if (sysTypeProp != null)
                        {
                            sysType = (Type)sysTypeProp.ComputedValue;
                        }

                        var node = new IntellisenseEntry
                        {
                            Name        = varName,
                            Type        = IntellisenseEntryType.Primitive,
                            SystemType  = sysType,
                            Description = string.Empty
                        };

                        if (sysType != null)
                        {
                            var tempNode = new IntellisenseEntry();
                            IntellisenseBuilder.AddTypeNode(tempNode, sysType, true);
                            node.Children.AddRange(tempNode.Children[0].Children);
                        }

                        tn.Children.Insert(count++, node);
                    }
                }
            }

            return(tn);
        }
Beispiel #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 public EditorService()
 {
     // Load the intellisense from all known assemblies.
     _intellisenseData = IntellisenseBuilder.LoadAsync();
 }