Пример #1
0
        /// <summary>
        /// Find the expression the cursor is at.
        /// Also determines the context (using statement, "new"-expression etc.) the
        /// cursor is at.
        /// </summary>
        Dom.ExpressionResult FindExpression(TextArea textArea)
        {
            Dom.IExpressionFinder finder = new Dom.CSharp.CSharpExpressionFinder(mainForm.parseInformation);

            Dom.ExpressionResult expression = finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset);
            if (expression.Region.IsEmpty)
            {
                expression.Region = new Dom.DomRegion(textArea.Caret.Line + 1, textArea.Caret.Column + 1);
            }

            //the previous char must be empty.
            if (textArea.Caret.Offset > 0)
            {
                string text = textArea.Document.GetText(textArea.Caret.Offset - 1, 1);
                //if (char.IsLetterOrDigit(text[0]) || text == "'" || text == ".")
                if (text != " " && text != "\n")
                {
                    expression.Expression = "xxx";
                }
                else
                {
                    expression.Expression = "";
                }
            }
            return(expression);
        }
        /// <summary>
        /// Find the expression the cursor is at.
        /// Also determines the context (using statement, "new"-expression etc.) the
        /// cursor is at.
        /// </summary>
        Dom.ExpressionResult FindExpression(TextArea textArea)
        {
            Dom.IExpressionFinder finder;

            finder = new Dom.CSharp.CSharpExpressionFinder(mainForm.parseInformation);

            Dom.ExpressionResult expression = finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset);
            if (expression.Region.IsEmpty)
            {
                expression.Region = new Dom.DomRegion(textArea.Caret.Line + 1, textArea.Caret.Column + 1);
            }
            return(expression);
        }
 /// <summary>
 /// Find the expression the cursor is at.
 /// Also determines the context (using statement, "new"-expression etc.) the
 /// cursor is at.
 /// </summary>
 Dom.ExpressionResult FindExpression(TextArea textArea)
 {
     if (mainForm.Language == "C#")
     {
         Dom.CSharp.CSharpExpressionFinder finder;
         finder = new Dom.CSharp.CSharpExpressionFinder(mainForm.DummyFileName);
         return(finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset));
     }
     else
     {
         Dom.VBNet.VBExpressionFinder finder;
         finder = new Dom.VBNet.VBExpressionFinder();
         return(finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset));
     }
 }
Пример #4
0
        /// <summary>
        /// Find the expression the cursor is at.
        /// Also determines the context (using statement, "new"-expression etc.) the
        /// cursor is at.
        /// </summary>
        Dom.ExpressionResult FindExpression(TextArea textArea)
        {
            Dom.IExpressionFinder finder;

            finder = new Dom.CSharp.CSharpExpressionFinder(mainForm.parseInformation);

            Dom.ExpressionResult expression = finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset);
            if (expression.Region.IsEmpty) {
                expression.Region = new Dom.DomRegion(textArea.Caret.Line + 1, textArea.Caret.Column + 1);
            }
            return expression;
        }
Пример #5
0
        /// <summary>
        /// Find the expression the cursor is at.
        /// Also determines the context (using statement, "new"-expression etc.) the
        /// cursor is at.
        /// </summary>
        Dom.ExpressionResult FindExpression(TextArea textArea)
        {
            Dom.IExpressionFinder finder = new Dom.CSharp.CSharpExpressionFinder(mainForm.parseInformation);

            Dom.ExpressionResult expression = finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset);
            if (expression.Region.IsEmpty) {
                expression.Region = new Dom.DomRegion(textArea.Caret.Line + 1, textArea.Caret.Column + 1);
            }

            //the previous char must be empty.
            if (textArea.Caret.Offset > 0)
            {
                string text = textArea.Document.GetText(textArea.Caret.Offset - 1, 1);
                //if (char.IsLetterOrDigit(text[0]) || text == "'" || text == ".")
                if (text != " " && text != "\n")
                {
                    expression.Expression = "xxx";
                }
                else
                {
                    expression.Expression = "";
                }
            }
            return expression;
        }
Пример #6
0
 /// <summary>
 /// Find the expression the cursor is at.
 /// Also determines the context (using statement, "new"-expression etc.) the
 /// cursor is at.
 /// </summary>
 Dom.ExpressionResult FindExpression(TextArea textArea)
 {
     Dom.CSharp.CSharpExpressionFinder finder;
     finder = new Dom.CSharp.CSharpExpressionFinder(_document.ContentFile.FullName);
     return(finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset));
 }
 /// <summary>
 /// Find the expression the cursor is at.
 /// Also determines the context (using statement, "new"-expression etc.) the
 /// cursor is at.
 /// </summary>
 Dom.ExpressionResult FindExpression(TextArea textArea)
 {
     Dom.CSharp.CSharpExpressionFinder finder;
     finder = new Dom.CSharp.CSharpExpressionFinder(ScriptForm.DummyFileName);
     return(finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset));
 }
 /// <summary>
 /// Find the expression the cursor is at.
 /// Also determines the context (using statement, "new"-expression etc.) the
 /// cursor is at.
 /// </summary>
 Dom.ExpressionResult FindExpression(TextArea textArea)
 {
     Dom.CSharp.CSharpExpressionFinder finder;
     finder = new Dom.CSharp.CSharpExpressionFinder(MainForm.DummyFileName);
     return finder.FindExpression(textArea.Document.TextContent, textArea.Caret.Offset);
 }