Пример #1
0
        async void OnDiagnosticsUpdated(object sender, DiagnosticsUpdatedArgs e)
        {
            if (!enabled)
            {
                return;
            }

            var doc = DocumentContext.ParsedDocument;

            if (doc == null || DocumentContext.IsAdHocProject)
            {
                return;
            }

            if (DocumentContext.AnalysisDocument == null)
            {
                return;
            }

            if (e.DocumentId != DocumentContext.AnalysisDocument.Id || e.ProjectId != DocumentContext.AnalysisDocument.Project.Id)
            {
                return;
            }

            var token = CancelUpdateTimeout(e.Id);
            var ad    = new AnalysisDocument(Editor, DocumentContext);

            try {
                var result = await CodeDiagnosticRunner.Check(ad, token, e.Diagnostics).ConfigureAwait(false);

                var updater = new ResultsUpdater(this, result, e.Id, token);
                updater.Update();
            } catch (Exception) {
            }
        }
Пример #2
0
        void OnDocumentParsed(object sender, EventArgs args)
        {
            if (!QuickTaskStrip.EnableFancyFeatures)
            {
                return;
            }
            CancelUpdateTimout();
            var doc = Document.ParsedDocument;

            if (doc == null)
            {
                return;
            }
            updateTimeout = GLib.Timeout.Add(250, delegate {
                lock (updateLock) {
                    CancelTask();
                    src       = new CancellationTokenSource();
                    var token = src.Token;
                    oldTask   = Task.Run(() => {
                        var result  = CodeAnalysisRunner.Check(Document, doc, token);
                        var updater = new ResultsUpdater(this, result, token);
                        updater.Update();
                    });
                    updateTimeout = 0;
                    return(false);
                }
            });
        }
Пример #3
0
        void OnDocumentParsed(object sender, EventArgs args)
        {
            if (!AnalysisOptions.EnableFancyFeatures)
            {
                return;
            }
            CancelUpdateTimout();
            var doc = DocumentContext.ParsedDocument;

            if (doc == null)
            {
                return;
            }
            updateTimeout = GLib.Timeout.Add(250, delegate {
                lock (updateLock) {
                    CancelTask();
                    src       = new CancellationTokenSource();
                    var token = src.Token;
                    var ad    = new AnalysisDocument(Editor, DocumentContext);
                    oldTask   = Task.Run(() => {
                        try {
                            var result = CodeDiagnosticRunner.Check(ad, token);
                            if (token.IsCancellationRequested)
                            {
                                return;
                            }
                            var updater = new ResultsUpdater(this, result, token);
                            updater.Update();
                        } catch (OperationCanceledException) {
                        } catch (AggregateException) {
                        }
                    });
                    updateTimeout = 0;
                    return(false);
                }
            });
        }
		void OnDocumentParsed (object sender, EventArgs args)
		{
			if (!AnalysisOptions.EnableFancyFeatures)
				return;
			CancelUpdateTimout ();
			var doc = DocumentContext.ParsedDocument;
			if (doc == null || DocumentContext.IsAdHocProject)
				return;
			updateTimeout = GLib.Timeout.Add (250, delegate {
				lock (updateLock) {
					CancelTask ();
					src = new CancellationTokenSource ();
					var token = src.Token;
					var ad = new AnalysisDocument (Editor, DocumentContext);
					Task.Run (() => {
						try {
							var result = CodeDiagnosticRunner.Check (ad, token).Result;
							if (token.IsCancellationRequested)
								return;
							var updater = new ResultsUpdater (this, result, token);
							updater.Update ();
						} catch (OperationCanceledException) {
						} catch (AggregateException) {
						}
					});
					updateTimeout = 0;
					return false;
				}
			});
		}
		void OnDocumentParsed (object sender, EventArgs args)
		{
			if (!QuickTaskStrip.EnableFancyFeatures)
				return;
			CancelUpdateTimout ();
			var doc = Document.ParsedDocument;
			if (doc == null)
				return;
			updateTimeout = GLib.Timeout.Add (250, delegate {
				lock (updateLock) {
					CancelTask ();
					src = new CancellationTokenSource ();
					var token = src.Token;
					oldTask = Task.Run (() => {
						var result = CodeAnalysisRunner.Check (Document, doc, token);
						var updater = new ResultsUpdater (this, result, token);
						updater.Update ();
					});
					updateTimeout = 0;
					return false;
				}
			});
		}