public RuleSetFile(string filePath, IVsFileChangeEx fileChangeService, VisualStudioRuleSetManager ruleSetManager)
            {
                _filePath       = filePath;
                _ruleSetManager = ruleSetManager;

                ImmutableArray <string> includes;

                try
                {
                    includes = RuleSet.GetEffectiveIncludesFromFile(filePath);
                }
                catch (Exception e)
                {
                    // We couldn't read the rule set for whatever reason. Capture the exception
                    // so we can surface the error later, and subscribe to file change notifications
                    // so that we'll automatically reload the file if the user can fix the issue.
                    _optionsRead = true;
                    _specificDiagnosticOptions = ImmutableDictionary <string, ReportDiagnostic> .Empty;
                    _exception = e;

                    includes = ImmutableArray.Create(filePath);
                }

                _trackers = new List <FileChangeTracker>(capacity: includes.Length);

                foreach (var include in includes)
                {
                    var tracker = new FileChangeTracker(fileChangeService, include);
                    tracker.UpdatedOnDisk += IncludeUpdated;
                    tracker.StartFileChangeListeningAsync();

                    _trackers.Add(tracker);
                }
            }
            public RuleSetFile(string filePath, IVsFileChangeEx fileChangeService, VisualStudioRuleSetManager ruleSetManager)
            {
                _filePath = filePath;
                _ruleSetManager = ruleSetManager;

                ImmutableArray<string> includes;

                try
                {
                    includes = RuleSet.GetEffectiveIncludesFromFile(filePath);
                }
                catch (Exception e)
                {
                    // We couldn't read the rule set for whatever reason. Capture the exception
                    // so we can surface the error later, and subscribe to file change notifications
                    // so that we'll automatically reload the file if the user can fix the issue.
                    _optionsRead = true;
                    _specificDiagnosticOptions = ImmutableDictionary<string, ReportDiagnostic>.Empty;
                    _exception = e;

                    includes = ImmutableArray.Create(filePath);
                }

                _trackers = new List<FileChangeTracker>(capacity: includes.Length);

                foreach (var include in includes)
                {
                    var tracker = new FileChangeTracker(fileChangeService, include);
                    tracker.UpdatedOnDisk += IncludeUpdated;
                    tracker.StartFileChangeListeningAsync();

                    _trackers.Add(tracker);
                }
            }
            public RuleSetFile(string filePath, VisualStudioRuleSetManager ruleSetManager)
            {
                FilePath        = filePath;
                _ruleSetManager = ruleSetManager;

                _disposalCancellationSource = new();
                _disposalToken = _disposalCancellationSource.Token;
            }
Exemplo n.º 4
0
        public void InitializeProviders(DocumentProvider documentProvider, VisualStudioMetadataReferenceManager metadataReferenceProvider, VisualStudioRuleSetManager ruleSetFileProvider)
        {
            AssertIsForeground();

            Contract.ThrowIfFalse(DocumentProvider == null);
            Contract.ThrowIfFalse(MetadataReferenceProvider == null);
            Contract.ThrowIfFalse(RuleSetFileProvider == null);

            DocumentProvider          = documentProvider;
            MetadataReferenceProvider = metadataReferenceProvider;
            RuleSetFileProvider       = ruleSetFileProvider;
        }
 public RuleSetFile(string filePath, VisualStudioRuleSetManager ruleSetManager)
 {
     FilePath        = filePath;
     _ruleSetManager = ruleSetManager;
 }
        public void InitializeProviders(DocumentProvider documentProvider, VisualStudioMetadataReferenceManager metadataReferenceProvider, VisualStudioRuleSetManager ruleSetFileProvider)
        {
            AssertIsForeground();

            Contract.ThrowIfFalse(DocumentProvider == null);
            Contract.ThrowIfFalse(MetadataReferenceProvider == null);
            Contract.ThrowIfFalse(RuleSetFileProvider == null);

            DocumentProvider = documentProvider;
            MetadataReferenceProvider = metadataReferenceProvider;
            RuleSetFileProvider = ruleSetFileProvider;
        }
Exemplo n.º 7
0
 public void InitializeProviders(DocumentProvider documentProvider, VisualStudioMetadataReferenceManager metadataReferenceProvider, VisualStudioRuleSetManager ruleSetFileProvider)
 {
     DocumentProvider = documentProvider;
 }