Exemplo n.º 1
0
        private bool TryWrapAbbreviation()
        {
            // Ensure that we have selection to wrap with abbreviation.
            if (View.WpfView.Selection.IsEmpty)
            {
                return(false);
            }

            var  editor = new EmmetEditor(View.WpfView, View.TextView);
            bool retVal = EmmetPackage.Instance.RunCommand(editor, PackageIds.CmdIDWrapWithAbbreviation);

            if (HasActiveTabStops)
            {
                CurrentSnippet.BeginEditSnippet();
                HighlightTabStops();
            }

            return(retVal);
        }
Exemplo n.º 2
0
        private bool TryExpandAbbreviation()
        {
            // Ensure that the caret is at the end of a non-empty line.
            SnapshotPoint     position = View.WpfView.Caret.Position.BufferPosition;
            ITextSnapshotLine line     = View.WpfView.Caret.Position.BufferPosition.GetContainingLine();
            string            txt      = line.GetText();

            if (string.IsNullOrWhiteSpace(txt) || position.Position != line.End)
            {
                return(false);
            }

            _completionBroker.DismissAllSessions(View.WpfView);
            var  editor = new EmmetEditor(View.WpfView, View.TextView);
            bool retVal = EmmetPackage.Instance.RunCommand(editor, PackageIds.CmdIDExpandAbbreviation);

            if (HasActiveTabStops)
            {
                CurrentSnippet.BeginEditSnippet();
                HighlightTabStops();
            }

            return(retVal);
        }
        private bool TryWrapAbbreviation()
        {
            // Ensure that we have selection to wrap with abbreviation.
            if (View.WpfView.Selection.IsEmpty)
                return false;

            var editor = new EmmetEditor(View.WpfView, View.TextView);
            bool retVal = EmmetPackage.Instance.RunCommand(editor, PackageIds.CmdIDWrapWithAbbreviation);

            if (HasActiveTabStops)
            {
                CurrentSnippet.BeginEditSnippet();
                HighlightTabStops();
            }

            return retVal;
        }
        private bool TryExpandAbbreviation()
        {
            // Ensure that the caret is at the end of a non-empty line.
            SnapshotPoint position = View.WpfView.Caret.Position.BufferPosition;
            ITextSnapshotLine line = View.WpfView.Caret.Position.BufferPosition.GetContainingLine();
            string txt = line.GetText();

            if (string.IsNullOrWhiteSpace(txt) || position.Position != line.End)
                return false;

            _completionBroker.DismissAllSessions(View.WpfView);
            var editor = new EmmetEditor(View.WpfView, View.TextView);
            bool retVal = EmmetPackage.Instance.RunCommand(editor, PackageIds.CmdIDExpandAbbreviation);

            if (HasActiveTabStops)
            {
                CurrentSnippet.BeginEditSnippet();
                HighlightTabStops();
            }

            return retVal;
        }