Ejemplo n.º 1
0
        ILanguageItem GetLanguageItem(TextIter ti)
        {
            string txt      = buf.Text;
            string fileName = ParentEditor.DisplayBinding.ContentName;

            if (fileName == null)
            {
                fileName = ParentEditor.DisplayBinding.UntitledName;
            }

            IParserContext ctx = GetParserContext();

            if (ctx == null)
            {
                return(null);
            }

            IExpressionFinder expressionFinder = null;

            if (fileName != null)
            {
                expressionFinder = ctx.GetExpressionFinder(fileName);
            }

            string expression = expressionFinder == null?TextUtilities.GetExpressionBeforeOffset(this, ti.Offset) : expressionFinder.FindFullExpression(txt, ti.Offset).Expression;

            if (expression == null)
            {
                return(null);
            }

            return(ctx.ResolveIdentifier(expression, ti.Line + 1, ti.LineOffset + 1, fileName, txt));
        }