private void AddSuggestionsForLeftNodeScope(IntellisenseData.IntellisenseData intellisenseData, TexlNode leftNode, bool isOneColumnTable, DType leftType)
            {
                Contracts.AssertValue(intellisenseData);
                Contracts.AssertValue(leftNode);
                Contracts.AssertValue(leftType);

                if (!intellisenseData.TryAddSuggestionsForLeftNodeScope(leftNode))
                {
                    if (TryGetEnumInfo(intellisenseData, leftNode, intellisenseData.Binding, out EnumSymbol enumInfo))
                    {
                        IntellisenseHelper.AddSuggestionsForEnum(intellisenseData, enumInfo);
                    }
                    else if (TryGetNamespaceFunctions(leftNode, intellisenseData.Binding, out IEnumerable <TexlFunction> namespaceFunctions))
                    {
                        AddSuggestionsForNamespace(intellisenseData, namespaceFunctions);
                    }
                    else if (TryGetLocalScopeInfo(leftNode, intellisenseData.Binding, out ScopedNameLookupInfo info))
                    {
                        IntellisenseHelper.AddTopLevelSuggestions(intellisenseData, info.Type);
                    }
                    else if (!isOneColumnTable)
                    {
                        AddSuggestionsForDottedName(intellisenseData, leftType);
                    }
                }

                intellisenseData.OnAddedSuggestionsForLeftNodeScope(leftNode);
            }
Beispiel #2
0
        /// <summary>
        /// Adds suggestions that start with the matchingString from the top level scope of the binding.
        /// </summary>
        internal static void AddSuggestionsForRuleScope(IntellisenseData.IntellisenseData intellisenseData)
        {
            Contracts.AssertValue(intellisenseData);
            Contracts.AssertValue(intellisenseData.Binding);

            var scopeType = intellisenseData.ContextScope;

            if (scopeType == null)
            {
                return;
            }

            IntellisenseHelper.AddTopLevelSuggestions(intellisenseData, scopeType);
        }
            // This method has logic to create Types for the TypedNames for a given type
            // if that type is Table.
            internal static void AddSuggestionsForDottedName(IntellisenseData.IntellisenseData intellisenseData, DType type)
            {
                Contracts.AssertValue(intellisenseData);
                Contracts.AssertValid(type);

                if (intellisenseData.TryAddCustomDottedNameSuggestions(type))
                {
                    return;
                }

                if (!type.IsTable)
                {
                    IntellisenseHelper.AddTopLevelSuggestions(intellisenseData, type);
                    return;
                }

                IntellisenseHelper.AddSuggestionsForNamesInType(type, intellisenseData, createTableSuggestion: true);
            }