protected async System.Threading.Tasks.Task <bool> LintBuildSelection(bool isBuildingSolution) { try { Benchmark.Start(); if (!LinterService.IsLinterEnabled) { return(false); } UIHierarchyItem[] selectedItems = BuildSelectedItems.Get(isBuildingSolution); Dictionary <string, string> fileToProjectMap; string[] files = WebLinterPackage.Settings.UseTsConfig ? TsconfigLocations.FindPathsFromSelectedItems(selectedItems, out fileToProjectMap) : LintFileLocations.FindPathsFromSelectedItems(selectedItems, out fileToProjectMap); if (!files.Any()) { return(false); } return(await LinterService.Lint(showErrorList : true, fixErrors : false, callSync : true, fileNames : files, clearAllErrors : true, fileToProjectMap)); } catch (Exception ex) { Logger.LogAndWarn(ex); Linter.Server.Down(); return(true); // Return value is true if we have VS errors } finally { Benchmark.End(); } }
public void SelectedItemsWhenBuidingSolutionTest() { UIHierarchyItem[] results = BuildSelectedItems.Get(isBuildingSolution: true); Assert.AreEqual(1, results.Length); Solution solutionObject = results[0].Object as Solution; Assert.IsNotNull(solutionObject); Assert.IsTrue(solutionObject.FullName .EndsWith("\\src\\WebLinterTest\\artifacts\\localinstall\\multiple\\multiple.sln")); }