/// <summary>
        /// Adds the word to the dictionary.
        /// </summary>
        /// <param name="solution">The solution that is active.</param>
        /// <param name="textControl">The text control that is currently in use.</param>
        public void Execute(ISolution solution, ITextControl textControl)
        {
            var settingsStore = solution.GetComponent <ISettingsStore>();
            var boundSettings = settingsStore.BindToContextTransient(ContextRange.Smart((lifetime, contexts) => contexts.Empty));

            boundSettings.SetIndexedValue <SpellCheckSettings, string, byte>(x => x.UserEntries, _word, 0);
            Shell.Instance.GetComponent <ShellSpellCheckResources>().NotifyNewUserDictionaryWord(_word); // we must also notify the active spell checker of the new ignored word
            DaemonBase.GetInstance(solution).ForceReHighlight(_highlight.Range.Document);                // without changing the document this is a way to request a re-processing of the document
        }
Ejemplo n.º 2
0
        private void DoResetAnalyzersCache()
        {
            this.threading.Dispatcher.AssertAccess();
            lock (this.syncObject)
            {
                this.referencedAnalyzers.Clear();
            }

            if (!this.solution.IsTemporary)
            {
                lock (this.syncObject)
                {
                    using (ReadLockCookie.Create())
                    {
                        // We don't actually look in nuget, we'll pull the data from the
                        // project system
                        foreach (var project in this.solution.GetTopLevelProjects())
                        {
                            var projectSearchDescriptor = project.ToProjectSearchDescriptor();
                            var vsProjectInfo           = projectModelSynchronizer.GetProjectInfoByProjectSearchDescriptor(projectSearchDescriptor);
                            if (vsProjectInfo != null)
                            {
                                var extProject = vsProjectInfo.GetExtProject();
                                if (extProject != null)
                                {
                                    var vsProject3 = extProject.Object as VSProject3;
                                    if (vsProject3 != null)
                                    {
                                        var projectId = project.GetPersistentID();

                                        var analyzerReferences = vsProject3.AnalyzerReferences;
                                        foreach (string analyzerReference in analyzerReferences)
                                        {
                                            var analyzerPath = FileSystemPath.Parse(analyzerReference);
                                            var analyzer     = analyzerPath.NameWithoutExtension;
                                            this.referencedAnalyzers.Add(projectId, analyzer.ToLowerInvariant());
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                // Can't inject, get a circular reference
                DaemonBase.GetInstance(this.solution).Invalidate();
            }
        }