public static IReadOnlyList <BaseInfo> GetValueCompletions(
            MSBuildValueKind kind,
            MSBuildRootDocument doc,
            MSBuildResolveResult rr          = null,
            ExpressionNode triggerExpression = null)
        {
            var simple = kind.GetSimpleValues(true);

            if (simple != null)
            {
                return(simple);
            }

            switch (kind)
            {
            case MSBuildValueKind.TaskOutputParameterName:
                return(doc.GetTaskParameters(rr.ParentName).Where(p => p.IsOutput).ToList());

            case MSBuildValueKind.TargetName:
                return(doc.GetTargets().ToList());

            case MSBuildValueKind.PropertyName:
                return(doc.GetProperties(true).ToList());

            case MSBuildValueKind.ItemName:
                return(doc.GetItems().ToList());

            case MSBuildValueKind.TargetFramework:
                return(FrameworkInfoProvider.Instance.GetFrameworksWithShortNames().ToList());

            case MSBuildValueKind.TargetFrameworkIdentifier:
                return(FrameworkInfoProvider.Instance.GetFrameworkIdentifiers().ToList());

            case MSBuildValueKind.TargetFrameworkVersion:
                return(doc.Frameworks.Select(f => f.Framework).Distinct().SelectMany(
                           id => FrameworkInfoProvider.Instance.GetFrameworkVersions(id)
                           ).Distinct().ToList());

            case MSBuildValueKind.TargetFrameworkProfile:
                return(doc.Frameworks.SelectMany(
                           tfm => FrameworkInfoProvider.Instance.GetFrameworkProfiles(tfm.Framework, tfm.Version)
                           ).Distinct().ToList());

            case MSBuildValueKind.Configuration:
                return(doc.GetConfigurations().Select(c => new ConstantInfo(c, "")).ToList());

            case MSBuildValueKind.Platform:
                return(doc.GetPlatforms().Select(c => new ConstantInfo(c, "")).ToList());
            }

            var fileCompletions = GetFilenameCompletions(kind, doc, triggerExpression, 0, rr);

            if (fileCompletions != null)
            {
                return(fileCompletions);
            }

            return(null);
        }
Пример #2
0
        public static IEnumerable <ISymbol> GetValueCompletions(
            MSBuildValueKind kind,
            MSBuildRootDocument doc,
            MSBuildResolveResult rr          = null,
            ExpressionNode triggerExpression = null)
        {
            var simple = kind.GetSimpleValues(true);

            if (simple != null)
            {
                return(simple);
            }

            switch (kind)
            {
            case MSBuildValueKind.TaskOutputParameterName:
                return(doc.GetTaskParameters(rr.ParentName).Where(p => p.IsOutput).ToList());

            case MSBuildValueKind.TargetName:
                return(doc.GetTargets().ToList());

            case MSBuildValueKind.PropertyName:
                return(doc.GetProperties(true).ToList());

            case MSBuildValueKind.ItemName:
                return(doc.GetItems().ToList());

            case MSBuildValueKind.TargetFramework:
                return(FrameworkInfoProvider.Instance.GetFrameworksWithShortNames().ToList());

            case MSBuildValueKind.TargetFrameworkIdentifier:
                return(FrameworkInfoProvider.Instance.GetFrameworkIdentifiers().ToList());

            case MSBuildValueKind.TargetFrameworkVersion:
                return(doc.Frameworks.Select(f => f.Framework).Distinct().SelectMany(
                           id => FrameworkInfoProvider.Instance.GetFrameworkVersions(id)
                           ).Distinct().ToList());

            case MSBuildValueKind.TargetFrameworkProfile:
                return(doc.Frameworks.SelectMany(
                           tfm => FrameworkInfoProvider.Instance.GetFrameworkProfiles(tfm.Framework, tfm.Version)
                           ).Distinct().ToList());

            case MSBuildValueKind.Configuration:
                return(doc.GetConfigurations().Select(c => new ConstantSymbol(c, "", MSBuildValueKind.Configuration)).ToList());

            case MSBuildValueKind.Platform:
                return(doc.GetPlatforms().Select(c => new ConstantSymbol(c, "", MSBuildValueKind.Platform)).ToList());

            case MSBuildValueKind.Condition:
                //FIXME: relax this a bit
                if (triggerExpression != null && triggerExpression is ExpressionText t && t.Length == 0)
                {
                    return(Builtins.ConditionFunctions.Values);
                }
                break;
            }

            var fileCompletions = GetFilenameCompletions(kind, doc, triggerExpression, 0, rr);

            if (fileCompletions != null)
            {
                return(fileCompletions);
            }

            return(null);
        }