private static string SortProperties(string text, IContentType contentType)
        {
            Sorter sorter = new Sorter();

            if (contentType.IsOfType("LESS"))
                return sorter.SortLess(text);

            return sorter.SortStyleSheet(text);
        }
        private string SortProperties(string text)
        {
            Sorter sorter = new Sorter();

            if (Path.GetExtension(_dte.ActiveDocument.FullName) == ".css")
            {
                return sorter.SortStyleSheet(text);
            }
            else if (Path.GetExtension(_dte.ActiveDocument.FullName) == ".less")
            {
                return sorter.SortLess(text);
            }

            return text;
        }
        public override void Invoke()
        {
            Sorter sorter = new Sorter();

            if (_view.TextBuffer.ContentType.IsOfType("LESS"))
            {
                sorter.SortLess(_rule.Text);
            }
            else
            {
                sorter.SortStyleSheet(_rule.Text);
            }

            var position = _view.Caret.Position.BufferPosition.Position;

            EditorExtensionsPackage.DTE.UndoContext.Open(DisplayText);

            _view.Caret.MoveTo(new SnapshotPoint(_span.TextBuffer.CurrentSnapshot, position));
            EditorExtensionsPackage.ExecuteCommand("Edit.FormatSelection");

            EditorExtensionsPackage.DTE.UndoContext.Close();
        }
        public override void Invoke()
        {
            Span ruleSpan = new Span(_rule.Start, _rule.Length);

            Sorter sorter = new Sorter();
            string result = null;

            if (_view.TextBuffer.ContentType.IsOfType("LESS"))
            {
                result = sorter.SortLess(_rule.Text);
            }
            else
            {
                result = sorter.SortStyleSheet(_rule.Text);
            }
            var position = _view.Caret.Position.BufferPosition;

            using (EditorExtensionsPackage.UndoContext((DisplayText)))
            {
                _span.TextBuffer.Replace(ruleSpan, result);
                _view.Caret.MoveTo(new SnapshotPoint(position.Snapshot.TextBuffer.CurrentSnapshot, position));
                EditorExtensionsPackage.ExecuteCommand("Edit.FormatSelection");
            }
        }
        public override void Invoke()
        {
            Span ruleSpan = new Span(_rule.Start, _rule.Length);

            Sorter sorter = new Sorter();
            string result = null;

            if (_view.TextBuffer.ContentType.IsOfType("LESS"))
            {
                result = sorter.SortLess(_rule.Text);
            }
            else
            {
                result = sorter.SortStyleSheet(_rule.Text);
            }
            //var declarations = _rule.Block.Declarations.OrderBy(d => d.PropertyName, new DeclarationComparer());
            var position = _view.Caret.Position.BufferPosition.Position;

            EditorExtensionsPackage.DTE.UndoContext.Open(DisplayText);

            _span.TextBuffer.Replace(ruleSpan, result);// string.Concat(declarations.Select(d => d.Text)));
            _view.Caret.MoveTo(new SnapshotPoint(_span.TextBuffer.CurrentSnapshot, position));
            EditorExtensionsPackage.ExecuteCommand("Edit.FormatSelection");

            EditorExtensionsPackage.DTE.UndoContext.Close();
        }