public void VsTextViewCreated(IVsTextView textViewAdapter) { var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); textView.Closed += TextviewClosed; if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _document)) { Task.Run(async() => { if (!LinterService.IsFileSupported(_document.FilePath)) { return; } _document.FileActionOccurred += DocumentSaved; textView.Properties.AddProperty("lint_filename", _document.FilePath); // Don't run linter again if error list already contains errors for the file. if (!TableDataSource.Instance.HasErrors(_document.FilePath)) { await LinterService.Lint(false, _document.FilePath); } }); } }
public void VsTextViewCreated(IVsTextView textViewAdapter) { var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); textView.Closed += TextviewClosed; if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _document)) { if (!LinterService.IsFileSupported(_document.FilePath)) { return; } WebLinterPackage.Dispatcher.BeginInvoke(new Action(() => { _document.FileActionOccurred += DocumentSaved; textView.Properties.AddProperty("lint_filename", _document.FilePath); // Don't run linter again if error list already contains errors for the file. if (!TableDataSource.Instance.HasErrors(_document.FilePath)) { LinterService.Lint(false, _document.FilePath); } }), DispatcherPriority.ApplicationIdle, null); } }
private void DocumentSaved(object sender, TextDocumentFileActionEventArgs e) { if (e.FileActionType == FileActionTypes.ContentSavedToDisk && LinterService.IsFileSupported(e.FilePath)) { LinterService.Lint(false, e.FilePath); } }
public void VsTextViewCreated(IVsTextView textViewAdapter) { var textView = EditorAdaptersFactoryService.GetWpfTextView(textViewAdapter); textView.Closed += TextviewClosed; // Both "Web Compiler" and "Bundler & Minifier" extensions add this property on their // generated output files. Generated output should be ignored from linting bool generated; if (textView.Properties.TryGetProperty("generated", out generated) && generated) { return; } if (TextDocumentFactoryService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _document)) { Task.Run(async() => { if (!LinterService.IsFileSupported(_document.FilePath)) { return; } _document.FileActionOccurred += DocumentSaved; textView.Properties.AddProperty("lint_filename", _document.FilePath); // Don't run linter again if error list already contains errors for the file. if (!TableDataSource.Instance.HasErrors(_document.FilePath)) { await LinterService.LintAsync(false, _document.FilePath); } }); } }