internal List <XSharpModel.IXErrorPosition> GetIntellisenseErrorPos(string fileName)
        {
            // dedupe errors based on filename, row, column,
            List <XSharpModel.IXErrorPosition> errorPos = new List <XSharpModel.IXErrorPosition>();
            Dictionary <string, string>        keys     = new Dictionary <string, string>();

            if (_errorList.AreOtherErrorSourceEntriesShown)
            {
                var intellisenseErrors = IntellisenseErrors;
                Dictionary <string, bool> filenames = new Dictionary <string, bool>();
                fileName = fileName.ToLower();

                foreach (var item in intellisenseErrors)
                {
                    string key  = item.Key;
                    string file = item.Filename.ToLower();
                    bool   isOpen;
                    if (filenames.ContainsKey(file))
                    {
                        isOpen = filenames[file];
                    }
                    else
                    {
                        isOpen = XSettings.IsDocumentOpen(file);
                        filenames.Add(file, isOpen);
                    }
                    if (isOpen && !keys.ContainsKey(key) && (file == fileName))
                    {
                        errorPos.Add(item);
                        keys.Add(key, key);
                    }
                    else
                    {
                        ; // duplicate item or file is closed
                    }
                }
            }
            return(errorPos);
        }
        internal void Refresh()
        {
            if (!dirty)
            {
                return;
            }
            // dedupe errors based on filename, row, column,
            IList <IErrorListItem>      errors = new List <IErrorListItem>();
            Dictionary <string, string> keys   = new Dictionary <string, string>();

            if (_errorList.AreBuildErrorSourceEntriesShown)
            {
                var buildErrors = BuildErrors;
                foreach (var item in buildErrors)
                {
                    string key = item.Key;
                    if (!keys.ContainsKey(key))
                    {
                        errors.Add(item);
                        keys.Add(key, key);
                    }
                    else
                    {
                        ; // duplicate item
                    }
                }
            }
            if (_errorList.AreOtherErrorSourceEntriesShown)
            {
                var intellisenseErrors = IntellisenseErrors;
                Dictionary <string, bool> filenames = new Dictionary <string, bool>();

                foreach (var item in intellisenseErrors)
                {
                    string key  = item.Key;
                    string file = item.Filename.ToLower();
                    bool   isOpen;
                    if (filenames.ContainsKey(file))
                    {
                        isOpen = filenames[file];
                    }
                    else
                    {
                        isOpen = XSettings.IsDocumentOpen(file);
                        filenames.Add(file, isOpen);
                    }
                    if (isOpen && !keys.ContainsKey(key))
                    {
                        errors.Add(item);
                        keys.Add(key, key);
                    }
                    else
                    {
                        ; // duplicate item or file is closed
                    }
                }
            }
            lock (this)
            {
                Factory.SetErrorItems(errors);
                dirty = false;
            }
        }