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); } }
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(); }