Ejemplo n.º 1
0
        internal CompletionAnalysis GetCompletions(ICompletionSession session, ITextView view, ITextSnapshot snapshot, ITrackingPoint point)
        {
            if (IsSpaceCompletion(snapshot, point) && session.IsCompleteWordMode())
            {
                // Cannot complete a word immediately after a space
                session.ClearCompleteWordMode();
            }

            var bi    = EditorServices.GetBufferInfo(snapshot.TextBuffer);
            var entry = bi?.AnalysisEntry;

            if (entry == null)
            {
                return(CompletionAnalysis.EmptyCompletionContext);
            }

            var options = session.GetOptions(Site);

            if (ReverseExpressionParser.IsInGrouping(snapshot, bi.GetTokensInReverseFromPoint(point.GetPoint(snapshot))))
            {
                options = options.Clone();
                options.IncludeStatementKeywords = false;
            }

            return(new CompletionAnalysis(
                       EditorServices,
                       session,
                       view,
                       snapshot,
                       point,
                       options
                       ));
        }