Exemplo n.º 1
0
            private CompletionList CreateDotCompletionList()
            {
                IEnumerable <ISymbol> members;

                if (symbolGuesser.TryGetTypeBefore(document, GetDotPosition(), cancellationToken, out var typeSymbol))
                {
                    if (typeSymbol is TypeWithMembersSymbolBase typeWithMembersSymbol)
                    {
                        members = typeWithMembersSymbol.Members;
                    }
                    else
                    {
                        // TODO This should never happen at this time.
                        throw new InvalidOperationException($"received a type symbol of type {typeSymbol.GetType()}, but expected a ClassSymbol");
                    }
                }
                else
                {
                    members = Enumerable.Empty <ISymbol>();
                }
                return(CreateCompletionListFromSymbols(members));
            }
Exemplo n.º 2
0
            private CompletionList CreateDotCompletionList()
            {
                IEnumerable <ISymbol> members;

                if (_symbolGuesser.TryGetTypeBefore(_document, GetDotPosition(), _cancellationToken, out var typeSymbol))
                {
                    // TODO Introduce a specialized symbol interface for types. At this time, the most types are treated as a UserDefinedType => class.
                    if (typeSymbol is ClassSymbol classSymbol)
                    {
                        members = classSymbol.Members;
                    }
                    else
                    {
                        // TODO This should never happen at this time.
                        throw new InvalidOperationException($"received a type symbol of type {typeSymbol.GetType()}, but expected a ClassSymbol");
                    }
                }
                else
                {
                    members = Enumerable.Empty <ISymbol>();
                }
                return(CreateCompletionListFromSymbols(members));
            }