示例#1
0
        public static async Task Lint(bool showErrorList, params string[] fileNames)
        {
            try
            {
                WebLinterPackage.Dte.StatusBar.Text = "Analyzing...";
                WebLinterPackage.Dte.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral);

                EnsureDefaults();

                var result = await LinterFactory.Lint(WebLinterPackage.Settings, fileNames);

                if (result != null)
                {
                    ErrorListService.ProcessLintingResults(result, showErrorList);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            finally
            {
                WebLinterPackage.Dte.StatusBar.Clear();
                WebLinterPackage.Dte.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral);
            }
        }
        public static async Task <bool> Lint(bool showErrorList, bool fixErrors, bool callSync,
                                             string[] fileNames, string[] filterFileNames = null)
        {
            bool hasVSErrors = false;

            try
            {
                WebLinterPackage.Dte.StatusBar.Text = "Analyzing...";
                WebLinterPackage.Dte.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral);

                await CopyResourceFilesToUserProfile(false, callSync);

                LintingResult[] result = await LinterFactory.Lint(WebLinterPackage.Settings, fixErrors, callSync,
                                                                  Logger.LogAndWarn, fileNames);

                if (result != null)
                {
                    ErrorListService.ProcessLintingResults(result, fileNames, filterFileNames, showErrorList);
                    hasVSErrors = result.Any(r => r.HasVsErrors);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            finally
            {
                WebLinterPackage.Dte.StatusBar.Clear();
                WebLinterPackage.Dte.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral);
            }
            return(hasVSErrors);
        }
示例#3
0
        public static void Lint(bool showErrorList, params string[] fileNames)
        {
            ThreadPool.QueueUserWorkItem((o) =>
            {
                try
                {
                    EnsureDefaults();

                    var result = LinterFactory.Lint(WebLinterPackage.Settings, fileNames);

                    if (result != null)
                    {
                        ErrorListService.ProcessLintingResults(result, showErrorList);
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log(ex);
                }
            });
        }
        public static async Task <bool> Lint(bool showErrorList, bool fixErrors, bool callSync,
                                             string[] fileNames, bool clearAllErrors, Dictionary <string, string> fileToProjectMap)
        {
#if DEBUG
            if (fileNames.Length == 0)
            {
                throw new Exception("LinterService/Lint called with empty fileNames list");
            }
#endif
            bool hasVSErrors = false;
            try
            {
                WebLinterPackage.Dte.StatusBar.Text = "Analyzing...";
                WebLinterPackage.Dte.StatusBar.Animate(true, vsStatusAnimation.vsStatusAnimationGeneral);

                await CopyResourceFilesToUserProfile(false, callSync);

                Linter        linter = new Linter(WebLinterPackage.Settings, fixErrors, Logger.LogAndWarn);
                LintingResult result = await linter.Lint(callSync, fileNames);

                if (result != null)
                {
                    ErrorListService.ProcessLintingResults(result, fileNames, clearAllErrors,
                                                           showErrorList, fixErrors, fileToProjectMap);
                    hasVSErrors = result.HasVsErrors;
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
            finally
            {
                WebLinterPackage.Dte.StatusBar.Clear();
                WebLinterPackage.Dte.StatusBar.Animate(false, vsStatusAnimation.vsStatusAnimationGeneral);
            }
            return(hasVSErrors);
        }