forked from madskristensen/WebEssentials2013
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Chain compile for LESS and SASS (madskristensen#189).
* Menu item to add file in ignore list. * Needs testing.
- Loading branch information
Showing
19 changed files
with
193 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
EditorExtensions/ExtensionMethods/DispatcherPriorityAwaitable.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
EditorExtensions/ExtensionMethods/DispatcherPriorityAwaiter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System.Collections.Generic; | ||
using System.ComponentModel.Design; | ||
using System.IO; | ||
using System.Linq; | ||
using EnvDTE80; | ||
using Microsoft.VisualStudio.Shell; | ||
|
||
namespace MadsKristensen.EditorExtensions | ||
{ | ||
internal class ChainCompilationMenu | ||
{ | ||
public OleMenuCommand Command { get; private set; } | ||
|
||
private DTE2 _dte; | ||
private OleMenuCommandService _mcs; | ||
private readonly IEnumerable<string> _sourceExtensions = Mef.GetChainedCompileExtensions(); | ||
private IEnumerable<string> selectedFiles; | ||
|
||
public ChainCompilationMenu(DTE2 dte, OleMenuCommandService mcs) | ||
{ | ||
_dte = dte; | ||
_mcs = mcs; | ||
} | ||
|
||
public void SetupCommands() | ||
{ | ||
PreCommand(CommandId.ChainCompile); | ||
_mcs.AddCommand(Command); | ||
} | ||
|
||
public void PreCommand(CommandId id) | ||
{ | ||
Mef.SatisfyImportsOnce(this); | ||
|
||
Command = new OleMenuCommand((s, e) => Execute(), new CommandID(CommandGuids.guidEditorExtensionsCmdSet, (int)id)); | ||
Command.BeforeQueryStatus += (s, e) => CheckVisible(); | ||
} | ||
|
||
private void CheckVisible() | ||
{ | ||
selectedFiles = ProjectHelpers.GetSelectedFilePaths() | ||
.Where(p => _sourceExtensions.Contains(Path.GetExtension(p))); | ||
Command.Enabled = selectedFiles.Any(); | ||
} | ||
private void Execute() | ||
{ | ||
foreach (var file in selectedFiles) | ||
{ | ||
ProjectHelpers.ChainIgnoreList.Add(file); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.