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); } }); } }
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; 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 async void DocumentSaved(object sender, TextDocumentFileActionEventArgs e) { if (e.FileActionType == FileActionTypes.ContentSavedToDisk) { await LinterService.LintAsync(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); } }); } }
private static async Task CallLinterService(string filePath) { if (WebLinterPackage.Settings.UseTsConfig) { Tsconfig tsconfig = TsconfigLocations.FindFromProjectItem(filePath); if (tsconfig == null) { return; } await LinterService.Lint(false, false, false, new string[] { tsconfig.FullName }, new string[] { filePath }); } else { await LinterService.Lint(false, false, false, new string[] { filePath }); } }
private static async Task LintFile(string filePath) { Benchmark.Start(); Benchmark.Log("In SourceFileCreationListener.LintFile, path=" + filePath); if (WebLinterPackage.Settings.UseTsConfig) { string tsconfig = TsconfigLocations.FindParentTsconfig(filePath); if (tsconfig == null) { return; } await LinterService.Lint(false, false, false, new string[] { tsconfig }, clearAllErrors : false, CreateFileToProjectMap(filePath)); } else { await LinterService.Lint(false, false, false, new string[] { filePath }, clearAllErrors : false, CreateFileToProjectMap(filePath)); } Benchmark.End(); }