﻿using System;
using System.ComponentModel.Composition;

using NQuery.Syntax;

namespace NQuery.Authoring.QuickInfo
{
    [Export(typeof(IQuickInfoModelProvider))]
    internal sealed class ExpressionSelectColumnQuickInfoModelProvider : QuickInfoModelProvider<ExpressionSelectColumnSyntax>
    {
        protected override QuickInfoModel CreateModel(SemanticModel semanticModel, int position, ExpressionSelectColumnSyntax node)
        {
            if (node.Alias == null)
                return null;

            var symbol = semanticModel.GetDeclaredSymbol(node);
            return symbol == null
                       ? null
                       : QuickInfoModel.ForSymbol(semanticModel, node.Alias.Identifier.Span, symbol);
        }
    }
}

﻿using System;
using System.ComponentModel.Composition;

using NQuery.Syntax;

namespace NQuery.Authoring.QuickInfo
{
    [Export(typeof(IQuickInfoModelProvider))]
    internal sealed class ExpressionSelectColumnQuickInfoModelProvider : QuickInfoModelProvider<ExpressionSelectColumnSyntax>
    {
        protected override QuickInfoModel CreateModel(SemanticModel semanticModel, int position, ExpressionSelectColumnSyntax node)
        {
            if (node.Alias == null || !node.Alias.Span.Contains(position))
                return null;

            var symbol = semanticModel.GetDeclaredSymbol(node);
            return symbol == null
                       ? null
                       : QuickInfoModel.ForSymbol(semanticModel, node.Alias.Identifier.Span, symbol);
        }
    }
}

Fix bug in IQuickInfoModelProvider for SELECT column aliases
Fix bug in IQuickInfoModelProvider for SELECT column aliases

The current implementation is too eager. This results in no quick
info being displayed for any part except for the column alias.
