private void BuildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action)
        {
            if (Action != vsBuildAction.vsBuildActionClean)
            {
                if (WESettings.GetBoolean(WESettings.Keys.LessCompileOnBuild))
                {
                    _dte.Commands.Raise(GuidList.guidBuildCmdSetString, (int)PkgCmdIDList.cmdBuildLess, null, null);
                }
                //LessProjectCompiler.CompileProject();

                if (WESettings.GetBoolean(WESettings.Keys.CoffeeScriptCompileOnBuild))
                {
                    _dte.Commands.Raise(GuidList.guidBuildCmdSetString, (int)PkgCmdIDList.cmdBuildCoffeeScript, null, null);
                }

                //BundleFilesMenu.UpdateBundles(null, true);
                _dte.Commands.Raise(GuidList.guidBuildCmdSetString, (int)PkgCmdIDList.cmdBuildBundles, null, null);

                if (WESettings.GetBoolean(WESettings.Keys.RunJsHintOnBuild))
                {
                    Dispatcher.CurrentDispatcher.BeginInvoke(
                        new Action(() => JsHintProjectRunner.RunOnAllFilesInProject()), DispatcherPriority.ApplicationIdle, null);
                }
            }
            else if (Action == vsBuildAction.vsBuildActionClean)
            {
                System.Threading.Tasks.Task.Run(() => JsHintRunner.Reset());
            }
        }
        private void DocumentSavedHandler(object sender, TextDocumentFileActionEventArgs e)
        {
            if (!WESettings.GetBoolean(WESettings.Keys.EnableJsHint))
            {
                return;
            }

            ITextDocument document = (ITextDocument)sender;

            if (_isDisposed || document.TextBuffer == null)
            {
                return;
            }

            switch (e.FileActionType)
            {
            case FileActionTypes.ContentLoadedFromDisk:
                break;

            case FileActionTypes.DocumentRenamed:
                _runner.Dispose();
                _runner = new JsHintRunner(_document.FilePath);

                goto case FileActionTypes.ContentSavedToDisk;

            case FileActionTypes.ContentSavedToDisk:
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(_runner.RunCompiler), DispatcherPriority.ApplicationIdle, null);
                break;
            }
        }
Example #3
0
        private void RunJsHint()
        {
            JsHintRunner.Reset();

            foreach (string file in files)
            {
                JsHintRunner runner = new JsHintRunner(file);
                runner.RunCompiler();
            }
        }
Example #4
0
        private void RunJsHint()
        {
            JsHintRunner.Reset();

            foreach (string file in files)
            {
                JsHintRunner runner = new JsHintRunner(file);
                runner.RunCompiler();
            }
        }
Example #5
0
        void menuCommand_BeforeQueryStatus(object sender, System.EventArgs e)
        {
            OleMenuCommand menuCommand = sender as OleMenuCommand;

            var raw = MinifyFileMenu.GetSelectedFilePaths(_dte);

            files = raw.Where(f => !JsHintRunner.ShouldIgnore(f)).ToList();

            menuCommand.Enabled = files.Count > 0;
        }
        public JsHintProjectRunner(ITextDocument document)
        {
            _document = document;
            _document.FileActionOccurred += DocumentSavedHandler;
            _runner = new JsHintRunner(_document.FilePath);

            if (WESettings.GetBoolean(WESettings.Keys.EnableJsHint))
            {
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => _runner.RunCompiler()), DispatcherPriority.ApplicationIdle, null);
            }
        }
        public JsHintProjectRunner(ITextDocument document)
        {
            _document = document;
            _document.FileActionOccurred += DocumentSavedHandler;
            _runner = new JsHintRunner(_document.FilePath);

            if (WESettings.GetBoolean(WESettings.Keys.EnableJsHint))
            {
                Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => _runner.RunCompiler()), DispatcherPriority.ApplicationIdle, null);
            }
        }
        public static void RunOnAllFilesInProject()
        {
            string dir = ProjectHelpers.GetRootFolder();

            if (dir != null && Directory.Exists(dir))
            {
                foreach (string file in Directory.GetFiles(dir, "*.js", SearchOption.AllDirectories))
                {
                    JsHintRunner runner = new JsHintRunner(file);
                    runner.RunCompiler();
                }
            }
        }
        public static void RunOnAllFilesInProject()
        {
            string dir = ProjectHelpers.GetRootFolder();

            if (dir != null && Directory.Exists(dir))
            {
                foreach (string file in Directory.GetFiles(dir, "*.js", SearchOption.AllDirectories))
                {
                    JsHintRunner runner = new JsHintRunner(file);
                    runner.RunCompiler();
                }
            }
        }
        private void DocumentSavedHandler(object sender, TextDocumentFileActionEventArgs e)
        {
            if (!WESettings.GetBoolean(WESettings.Keys.EnableJsHint))
                return;

            ITextDocument document = (ITextDocument)sender;
            if (_isDisposed || document.TextBuffer == null)
                return;

            switch (e.FileActionType)
            {
                case FileActionTypes.ContentLoadedFromDisk:
                    break;
                case FileActionTypes.DocumentRenamed:
                    _runner.Dispose();
                    _runner = new JsHintRunner(_document.FilePath);

                    goto case FileActionTypes.ContentSavedToDisk;
                case FileActionTypes.ContentSavedToDisk:
                    Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => _runner.RunCompiler()), DispatcherPriority.ApplicationIdle, null);
                    break;
            }
        }