Beispiel #1
0
        public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context)
        {
            if (!WESettings.GetBoolean(WESettings.Keys.ValidateVendorSpecifics))
            {
                return(ItemCheckResult.Continue);
            }

            if (!item.IsValid || context == null)
            {
                return(ItemCheckResult.Continue);
            }

            ICssSchemaInstance rootSchema = CssSchemaManager.SchemaManager.GetSchemaRoot(null);
            ICssSchemaInstance schema     = CssSchemaManager.SchemaManager.GetSchemaForItem(rootSchema, item);

            string normalized = item.Text.Trim(':');

            if (normalized.Length > 0 && normalized[0] == '-' && schema.GetPseudo(item.Text) == null)
            {
                string message = string.Format(Resources.ValidationVendorPseudo, item.Text);
                context.AddError(new SimpleErrorTag(item, message, CssErrorFlags.TaskListWarning | CssErrorFlags.UnderlineRed));
                return(ItemCheckResult.CancelCurrentItem);
            }

            return(ItemCheckResult.Continue);
        }
Beispiel #2
0
        protected override bool Execute(uint commandId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
        {
            if (commandId == 4 && !_broker.IsCompletionActive(TextView))
            {
                if (WESettings.GetBoolean(WESettings.Keys.EnableHtmlZenCoding))
                {
                    if (InvokeZenCoding())
                    {
                        return(true);
                    }
                    else if (MoveToNextEmptySlot())
                    {
                        return(true);
                    }
                }
            }
            else if (commandId == 5 && !_broker.IsCompletionActive(TextView))
            {
                if (WESettings.GetBoolean(WESettings.Keys.EnableHtmlZenCoding) && MoveToPrevEmptySlot())
                {
                    return(true);
                }
            }

            return(false);
        }
 public override void LoadSettingsFromStorage()
 {
     EnableMustache        = WESettings.GetBoolean(WESettings.Keys.EnableMustache);
     EnableHtmlZenCoding   = WESettings.GetBoolean(WESettings.Keys.EnableHtmlZenCoding);
     KeepImportantComments = WESettings.GetBoolean(WESettings.Keys.KeepImportantComments);
     UseBom = WESettings.GetBoolean(WESettings.Keys.UseBom);
 }
        public IEnumerable <ITagSpan <IOutliningRegionTag> > GetTags(NormalizedSnapshotSpanCollection spans)
        {
            if (spans.Count == 0 || !WESettings.GetBoolean(WESettings.Keys.EnableJavascriptRegions))
            {
                yield break;
            }

            List <Region> currentRegions  = this.regions;
            ITextSnapshot currentSnapshot = this.snapshot;

            SnapshotSpan entire          = new SnapshotSpan(spans[0].Start, spans[spans.Count - 1].End).TranslateTo(currentSnapshot, SpanTrackingMode.EdgeExclusive);
            int          startLineNumber = entire.Start.GetContainingLine().LineNumber;
            int          endLineNumber   = entire.End.GetContainingLine().LineNumber;

            foreach (var region in currentRegions)
            {
                if (region.StartLine <= endLineNumber && region.EndLine >= startLineNumber)
                {
                    var startLine = currentSnapshot.GetLineFromLineNumber(region.StartLine);
                    var endLine   = currentSnapshot.GetLineFromLineNumber(region.EndLine);

                    var    snapshot = new SnapshotSpan(startLine.Start + region.StartOffset, endLine.End);
                    Match  match    = regex.Match(snapshot.GetText());
                    string text     = string.IsNullOrWhiteSpace(match.Groups[1].Value) ? "#region" : match.Groups[1].Value.Trim();

                    //the region starts at the beginning of the "[", and goes until the *end* of the line that contains the "]".
                    yield return(new TagSpan <IOutliningRegionTag>(
                                     snapshot,
                                     new OutliningRegionTag(false, true, " " + text + " ", hoverText)));
                }
            }
        }
Beispiel #5
0
        private static bool CanCompile(string fileName)
        {
            if (EditorExtensionsPackage.DTE.Solution.FindProjectItem(fileName) == null)
            {
                return(false);
            }

            if (Path.GetFileName(fileName).StartsWith("_"))
            {
                return(false);
            }

            if (MadsKristensen.EditorExtensions.WEIgnore.TestWEIgnore(fileName, "compiler", "less"))
            {
                Logger.Log(String.Format(CultureInfo.CurrentCulture, "LESS: The file {0} is ignored by .weignore. Skipping..", Path.GetFileName(fileName)));
                return(false);
            }

            string minFile = MarginBase.GetCompiledFileName(fileName, ".min.css", WESettings.GetBoolean(WESettings.Keys.LessCompileToFolder));

            if (File.Exists(minFile) && WESettings.GetBoolean(WESettings.Keys.LessMinify))
            {
                return(true);
            }

            string cssFile = MarginBase.GetCompiledFileName(fileName, ".css", WESettings.GetBoolean(WESettings.Keys.LessCompileToFolder));

            if (!File.Exists(cssFile))
            {
                return(false);
            }


            return(true);
        }
Beispiel #6
0
        public static string MinifyString(string extension, string content)
        {
            if (extension == ".css")
            {
                Minifier    minifier = new Minifier();
                CssSettings settings = new CssSettings();
                settings.CommentMode = CssComment.None;

                if (WESettings.GetBoolean(WESettings.Keys.KeepImportantComments))
                {
                    settings.CommentMode = CssComment.Important;
                }

                return(minifier.MinifyStyleSheet(content, settings));
            }
            else if (extension == ".js")
            {
                Minifier     minifier = new Minifier();
                CodeSettings settings = new CodeSettings()
                {
                    EvalTreatment             = EvalTreatment.MakeImmediateSafe,
                    PreserveImportantComments = WESettings.GetBoolean(WESettings.Keys.KeepImportantComments)
                };

                return(minifier.MinifyJavaScript(content, settings));
            }

            return(null);
        }
Beispiel #7
0
        public static void MinifyFile(string lessFileName, string source)
        {
            if (WESettings.GetBoolean(WESettings.Keys.LessMinify))
            {
                string content = MinifyFileMenu.MinifyString(".css", source);
                string minFile = MarginBase.GetCompiledFileName(lessFileName, ".min.css", WESettings.GetBoolean(WESettings.Keys.LessCompileToFolder)); //lessFileName.Replace(".less", ".min.css");
                string old     = File.ReadAllText(minFile);

                if (old != content)
                {
                    bool fileExist = File.Exists(minFile);
                    bool useBom    = WESettings.GetBoolean(WESettings.Keys.UseBom);

                    ProjectHelpers.CheckOutFileFromSourceControl(minFile);
                    using (StreamWriter writer = new StreamWriter(minFile, false, new UTF8Encoding(useBom)))
                    {
                        writer.Write(content);
                    }

                    if (!fileExist)
                    {
                        MarginBase.AddFileToProject(lessFileName, minFile);
                    }
                }
            }
        }
Beispiel #8
0
        private static bool CanCompile(string fileName)
        {
            if (EditorExtensionsPackage.DTE.Solution.FindProjectItem(fileName) == null)
            {
                return(false);
            }

            if (Path.GetFileName(fileName).StartsWith("_"))
            {
                return(false);
            }

            string minFile = MarginBase.GetCompiledFileName(fileName, ".min.css", WESettings.GetBoolean(WESettings.Keys.LessCompileToFolder));

            if (File.Exists(minFile) && WESettings.GetBoolean(WESettings.Keys.LessMinify))
            {
                return(true);
            }

            string cssFile = MarginBase.GetCompiledFileName(fileName, ".css", WESettings.GetBoolean(WESettings.Keys.LessCompileToFolder));

            if (!File.Exists(cssFile))
            {
                return(false);
            }


            return(true);
        }
Beispiel #9
0
        protected override string CreateHtml(string source, string state)
        {
            string clean = source
                           .Replace("\\", "\\\\")
                           .Replace("\n", "\\n")
                           .Replace("\r", "\\r")
                           .Replace("'", "\\'");

            string bare   = WESettings.GetBoolean(WESettings.Keys.WrapCoffeeScriptClosure) ? "false" : "true";
            string script = ReadResourceFile("MadsKristensen.EditorExtensions.Resources.Scripts.CoffeeScript-1.6.3.js");

            if (WESettings.GetBoolean(WESettings.Keys.EnableIcedCoffeeScript))
            {
                script += ReadResourceFile("MadsKristensen.EditorExtensions.Resources.Scripts.IcedCoffeeScript-1.6.3-b.js");
            }

            script +=
                "try{" +
                "var result = CoffeeScript.compile('" + clean + "', { bare: " + bare + ", runtime:'inline' });" +
                "window.external.Execute(result, '" + state.Replace("\\", "\\\\") + "');" +
                "}" +
                "catch (err){" +
                "window.external.Execute('ERROR:' + err, '" + state.Replace("\\", "\\\\") + "');" +
                "}";

            return("<html><head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=9\" /><script>" + script + "</script></head><html/>");
        }
Beispiel #10
0
        public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context)
        {
            UrlItem url = (UrlItem)item;

            if (!WESettings.GetBoolean(WESettings.Keys.ValidateEmbedImages) || !url.IsValid || url.UrlString.Text.Contains("base64,") || context == null)
            {
                return(ItemCheckResult.Continue);
            }

            string fileName = ImageQuickInfo.GetFileName(url.UrlString.Text);

            if (fileName.Contains("://"))
            {
                return(ItemCheckResult.Continue);
            }

            FileInfo file = new FileInfo(fileName);

            if (file.Exists && file.Length < (1024 * 3))
            {
                Declaration dec = url.FindType <Declaration>();
                if (dec != null && dec.PropertyName != null && dec.PropertyName.Text[0] != '*' && dec.PropertyName.Text[0] != '_')
                {
                    string error = string.Format(Resources.PerformanceEmbedImageAsDataUri, file.Length);
                    context.AddError(new SimpleErrorTag(url.UrlString, error));
                }
            }

            return(ItemCheckResult.Continue);
        }
Beispiel #11
0
        //private HashSet<string> _deprecated = new HashSet<string>()
        //{
        //    "-moz-opacity",
        //    "-moz-outline",
        //    "-moz-outline-style",
        //};

        public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context)
        {
            if (!WESettings.GetBoolean(WESettings.Keys.ValidateVendorSpecifics))
            {
                return(ItemCheckResult.Continue);
            }

            Declaration dec = (Declaration)item;

            if (!dec.IsValid || !dec.IsVendorSpecific() || context == null)
            {
                return(ItemCheckResult.Continue);
            }

            ICssSchemaInstance rootSchema = CssSchemaManager.SchemaManager.GetSchemaRoot(null);
            ICssSchemaInstance schema     = CssSchemaManager.SchemaManager.GetSchemaForItem(rootSchema, item);

            //if (_deprecated.Contains(dec.PropertyName.Text))
            //{
            //    string message = string.Format(Resources.ValidationDeprecatedVendorDeclaration, dec.PropertyName.Text);
            //    context.AddError(new SimpleErrorTag(dec.PropertyName, message));
            //    return ItemCheckResult.CancelCurrentItem;
            //}
            if (schema.GetProperty(dec.PropertyName.Text) == null)
            {
                string message = string.Format(Resources.ValidationVendorDeclarations, dec.PropertyName.Text);
                context.AddError(new SimpleErrorTag(dec.PropertyName, message, CssErrorFlags.TaskListWarning | CssErrorFlags.UnderlineRed));
                return(ItemCheckResult.CancelCurrentItem);
            }

            return(ItemCheckResult.Continue);
        }
        private static void WriteMinFile(string filePath, string bundlePath, string content, string extension)
        {
            string minPath = bundlePath.Replace(Path.GetExtension(bundlePath), ".min" + Path.GetExtension(bundlePath));

            if (extension.Equals(".js", StringComparison.OrdinalIgnoreCase))
            {
                JavaScriptSaveListener.Minify(bundlePath, minPath, true);
                MarginBase.AddFileToProject(filePath, minPath);

                if (WESettings.GetBoolean(WESettings.Keys.GenerateJavaScriptSourceMaps))
                {
                    MarginBase.AddFileToProject(filePath, minPath + ".map");
                }

                MarginBase.AddFileToProject(filePath, minPath + ".gzip");
            }
            else if (extension.Equals(".css", StringComparison.OrdinalIgnoreCase))
            {
                string minContent = MinifyFileMenu.MinifyString(extension, content);

                ProjectHelpers.CheckOutFileFromSourceControl(minPath);

                using (StreamWriter writer = new StreamWriter(minPath, false, new UTF8Encoding(true)))
                {
                    writer.Write(minContent);
                }

                MarginBase.AddFileToProject(filePath, minPath);

                if (WESettings.GetBoolean(WESettings.Keys.CssEnableGzipping))
                {
                    CssSaveListener.GzipFile(filePath, minPath, minContent);
                }
            }
        }
Beispiel #13
0
        public static void Minify(string sourceFile, string minFile, bool isBundle)
        {
            if (sourceFile.EndsWith(".min.js"))
            {
                return;
            }

            try
            {
                CodeSettings settings = new CodeSettings()
                {
                    EvalTreatment             = EvalTreatment.MakeImmediateSafe,
                    TermSemicolons            = true,
                    PreserveImportantComments = WESettings.GetBoolean(WESettings.Keys.KeepImportantComments)
                };

                if (WESettings.GetBoolean(WESettings.Keys.GenerateJavaScriptSourceMaps))
                {
                    MinifyFileWithSourceMap(sourceFile, minFile, settings, isBundle);
                }
                else
                {
                    MinifyFile(sourceFile, minFile, settings, isBundle);
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }
        }
Beispiel #14
0
        public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context)
        {
            if (!WESettings.GetBoolean(WESettings.Keys.ValidateVendorSpecifics))
            {
                return(ItemCheckResult.Continue);
            }

            AtDirective dir = item as AtDirective;

            if (!dir.IsValid || !dir.IsVendorSpecific() || context == null)
            {
                return(ItemCheckResult.Continue);
            }


            ICssSchemaInstance rootSchema = CssSchemaManager.SchemaManager.GetSchemaRoot(null);
            ICssSchemaInstance schema     = CssSchemaManager.SchemaManager.GetSchemaForItem(rootSchema, dir);

            if (schema.GetAtDirective("@" + dir.Keyword.Text) == null)
            {
                string message = string.Format(Resources.ValidationVendorDirective, dir.Keyword.Text);
                context.AddError(new SimpleErrorTag(dir.Keyword, message, CssErrorFlags.TaskListWarning | CssErrorFlags.UnderlineRed));
                return(ItemCheckResult.CancelCurrentItem);
            }

            return(ItemCheckResult.Continue);
        }
        private bool WriteFile(string content, string fileName, bool fileExist, bool fileWritten)
        {
            try
            {
                if (fileExist || (!fileExist && CanWriteToDisk(content)))
                {
                    bool useBom = WESettings.GetBoolean(WESettings.Keys.UseBom);
                    using (StreamWriter writer = new StreamWriter(fileName, false, new UTF8Encoding(useBom)))
                    {
                        writer.Write(content);
                        fileWritten = true;
                    }
                }
            }
            catch (Exception ex)
            {
                var error = new CompilerError
                {
                    FileName = Document.FilePath,
                    Column   = 0,
                    Line     = 0,
                    Message  = "Could not write to " + Path.GetFileName(fileName)
                };

                CreateTask(error);

                Logger.Log(ex);
            }

            return(fileWritten);
        }
Beispiel #16
0
        private static void MinifyFile(string file, string minFile, CodeSettings settings, bool isBundle)
        {
            Minifier minifier = new Minifier();

            if (!isBundle)
            {
                minifier.FileName = Path.GetFileName(file);
            }

            string content = minifier.MinifyJavaScript(File.ReadAllText(file), settings);

            if (WESettings.GetBoolean(WESettings.Keys.GenerateJavaScriptSourceMaps))
            {
                content += Environment.NewLine + "//@ sourceMappingURL=" + Path.GetFileName(minFile) + ".map";
            }

            ProjectHelpers.CheckOutFileFromSourceControl(minFile);
            using (StreamWriter writer = new StreamWriter(minFile, false, new UTF8Encoding(true)))
            {
                writer.Write(content);
            }

            if (WESettings.GetBoolean(WESettings.Keys.JavaScriptEnableGzipping))
            {
                CssSaveListener.GzipFile(file, minFile, content);
            }
        }
Beispiel #17
0
        public IList <ClassificationSpan> GetClassificationSpans(SnapshotSpan span)
        {
            List <ClassificationSpan> spans = new List <ClassificationSpan>();

            if (!WESettings.GetBoolean(WESettings.Keys.SyncVendorValues) || !EnsureInitialized())
            {
                return(spans);
            }

            var declarations = Cache.Where(d => span.End <= d.AfterEnd && d.Start >= span.Start);

            foreach (Declaration dec in Cache.Where(d => d.PropertyName.Text.Length > 0 && span.Snapshot.Length >= d.AfterEnd))
            {
                if (dec.IsVendorSpecific())
                {
                    var ss = new SnapshotSpan(span.Snapshot, dec.Start, dec.Length);
                    var s  = new ClassificationSpan(ss, _decClassification);
                    spans.Add(s);
                }

                int start  = dec.Colon.AfterEnd;
                int length = dec.AfterEnd - start;
                if (span.Snapshot.Length > start + length)
                {
                    var ss2 = new SnapshotSpan(span.Snapshot, start, length);
                    var s2  = new ClassificationSpan(ss2, _valClassification);
                    spans.Add(s2);
                }
            }

            return(spans);
        }
Beispiel #18
0
        ///<summary>Returns a strongly-typed Settings object for the specified ContentType, or null if <see cref="WESettings"/> has no properties with that name (including base types) or type.</summary>
        ///<typeparam name="T">The interface to return.</typeparam>
        ///<remarks>
        /// If the ContentType has a settings property, but that property
        /// does not implement <typeparamref name="T"/>, this will return
        /// null, even if its base type has a settings property that does
        /// implement <typeparamref name="T"/>.  For example, this cannot
        /// return <see cref="IMinifierSettings"/> for LESS.
        ///</remarks>
        public static T ForContentType <T>(this WESettings settings, IContentType contentType) where T : class
        {
            if (contentType == null)
            {
                return(null);
            }
            var name = contentType.TypeName;

            if (name.Equals("HTMLX", StringComparison.OrdinalIgnoreCase))
            {
                name = "Html";
            }
            var prop = TypeAccessor <WESettings> .Properties.FirstOrDefault(p => p.Property.Name.Equals(name, StringComparison.OrdinalIgnoreCase));

            if (prop == null)
            {
                return(contentType.BaseTypes.Select(settings.ForContentType <T>)
                       .FirstOrDefault(o => o != null));
            }
            var typedProp = prop as ITypedPropertyAccessor <WESettings, T>;

            if (typedProp == null)
            {
                return(null);
            }
            return(typedProp.GetValue(settings));
        }
        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;
            }
        }
        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());
            }
        }
        public ItemCheckResult CheckItem(ParseItem item, ICssCheckerContext context)
        {
            if (!WESettings.GetBoolean(WESettings.Keys.ValidateZeroUnit))
            {
                return(ItemCheckResult.Continue);
            }

            NumericalValue number = (NumericalValue)item;
            UnitValue      unit   = number as UnitValue;

            if (unit == null || context == null)
            {
                return(ItemCheckResult.Continue);
            }

            // The 2nd and 3rd arguments to hsl() require units even when zero
            var function = unit.Parent.Parent as FunctionColor;

            if (function != null && function.FunctionName.Text.StartsWith("hsl", StringComparison.OrdinalIgnoreCase))
            {
                var arg = unit.Parent as FunctionArgument;
                if (arg != function.Arguments[0])
                {
                    return(ItemCheckResult.Continue);
                }
            }

            if (number.Number.Text == "0" && unit.UnitType != UnitType.Unknown && unit.UnitType != UnitType.Time)
            {
                string message = string.Format(Resources.BestPracticeZeroUnit, unit.UnitToken.Text);
                context.AddError(new SimpleErrorTag(number, message));
            }

            return(ItemCheckResult.Continue);
        }
Beispiel #22
0
        public static void Minify(string file, string minFile)
        {
            if (file.EndsWith(".min.css"))
            {
                return;
            }

            try
            {
                string content = MinifyFileMenu.MinifyString(".css", File.ReadAllText(file));

                ProjectHelpers.CheckOutFileFromSourceControl(minFile);
                using (StreamWriter writer = new StreamWriter(minFile, false, new UTF8Encoding(true)))
                {
                    writer.Write(content);
                }

                if (WESettings.GetBoolean(WESettings.Keys.CssEnableGzipping))
                {
                    GzipFile(file, minFile, content);
                }
            }
            catch
            {
                Logger.Log("Error minifying: " + file);
            }
        }
        public void Compile(string fileName)
        {
            string output = Path.GetTempFileName();

            ProcessStartInfo start = new ProcessStartInfo(@"cscript");

            start.WindowStyle    = ProcessWindowStyle.Hidden;
            start.CreateNoWindow = true;
            start.Arguments      = "//nologo //s \"" + GetExecutablePath() + "\" \"" + fileName + "\" \"" + output + "\"";
            if (WESettings.GetBoolean(WESettings.Keys.LessStrictMath))
            {
                start.Arguments += " --strictMath";
            }
            start.EnvironmentVariables["output"]   = output;
            start.EnvironmentVariables["fileName"] = fileName;
            start.UseShellExecute       = false;
            start.RedirectStandardError = true;

            Process p = new Process();

            p.StartInfo           = start;
            p.EnableRaisingEvents = true;
            p.Exited += ProcessExited;
            p.Start();
        }
        public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin)
        {
            string        source = textViewHost.TextView.TextBuffer.CurrentSnapshot.GetText();
            ITextDocument document;

            if (textViewHost.TextView.TextDataModel.DocumentBuffer.Properties.TryGetProperty(typeof(ITextDocument), out document))
            {
                switch (textViewHost.TextView.TextBuffer.ContentType.DisplayName)
                {
                case "LESS":
                    bool showLess = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
                    return(new LessMargin("CSS", source, showLess, document));

                //case "scss":
                //    return new ScssMargin("CSS", source, true, document);

                case "CoffeeScript":
                    bool showCoffee = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
                    return(new CoffeeScriptMargin("JavaScript", source, showCoffee, document));

                case "markdown":
                    return(new MarkdownMargin("text", source, true, document));

                case "TypeScript":
                    bool showTypeScript = WESettings.GetBoolean(WESettings.Keys.ShowTypeScriptPreviewWindow);
                    return(new TypeScriptMargin("JavaScript", source, showTypeScript, document));
                }
            }

            return(null);
        }
Beispiel #25
0
 public override void LoadSettingsFromStorage()
 {
     GenerateCssFileFromLess = WESettings.GetBoolean(WESettings.Keys.GenerateCssFileFromLess);
     ShowLessPreviewWindow   = WESettings.GetBoolean(WESettings.Keys.ShowLessPreviewWindow);
     LessMinify          = WESettings.GetBoolean(WESettings.Keys.LessMinify);
     LessCompileOnBuild  = WESettings.GetBoolean(WESettings.Keys.LessCompileOnBuild);
     LessCompileToFolder = WESettings.GetBoolean(WESettings.Keys.LessCompileToFolder);
 }
Beispiel #26
0
 public override void LoadSettingsFromStorage()
 {
     EnableJavascriptRegions      = WESettings.GetBoolean(WESettings.Keys.EnableJavascriptRegions);
     EnableJsMinification         = WESettings.GetBoolean(WESettings.Keys.EnableJsMinification);
     GenerateJavaScriptSourceMaps = WESettings.GetBoolean(WESettings.Keys.GenerateJavaScriptSourceMaps);
     JavaScriptAutoCloseBraces    = WESettings.GetBoolean(WESettings.Keys.JavaScriptAutoCloseBraces);
     JavaScriptOutlining          = WESettings.GetBoolean(WESettings.Keys.JavaScriptOutlining);
 }
 public override void LoadSettingsFromStorage()
 {
     GenerateJsFileFromCoffeeScript = WESettings.GetBoolean(WESettings.Keys.GenerateJsFileFromCoffeeScript);
     ShowCoffeeScriptPreviewWindow  = WESettings.GetBoolean(WESettings.Keys.ShowCoffeeScriptPreviewWindow);
     WrapCoffeeScriptClosure        = WESettings.GetBoolean(WESettings.Keys.WrapCoffeeScriptClosure);
     CoffeeScriptMinify             = WESettings.GetBoolean(WESettings.Keys.CoffeeScriptMinify);
     CoffeeScriptCompileToFolder    = WESettings.GetBoolean(WESettings.Keys.CoffeeScriptCompileToFolder);
     CoffeeScriptCompileOnBuild     = WESettings.GetBoolean(WESettings.Keys.CoffeeScriptCompileOnBuild);
 }
        public bool IsSupported(Version cssVersion, ICssCompletionListEntry entry)
        {
            if (WESettings.GetBoolean(WESettings.Keys.ShowUnsupported))
            {
                return(entry.IsSupported(cssVersion));
            }

            return(entry.GetAttribute("browsers") != "none" || entry.DisplayText.Contains("gradient"));
        }
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            if (WESettings.GetBoolean(WESettings.Keys.JavaScriptOutlining))
            {
                return(buffer.Properties.GetOrCreateSingletonProperty <JavaScriptArrayOutliningTagger>(() => new JavaScriptArrayOutliningTagger(buffer)) as ITagger <T>);
            }

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