public override CompletionSet GetCompletions(IGlyphService glyphService)
        {
            var start = _stopwatch.ElapsedMilliseconds;

            var completions = GetModules(glyphService, Text);
            var res = new PythonCompletionSet(Text, Text, Span, completions, new Completion[0]);

            var end = _stopwatch.ElapsedMilliseconds;

            if (/*Logging &&*/ end - start > TooMuchTime) {
                Trace.WriteLine(String.Format("{0} lookup time {1} for {2} imports", this, end - start, res.Completions.Count));
            }

            return res;
        }
        public override CompletionSet GetCompletions(IGlyphService glyphService)
        {
            var start = _stopwatch.ElapsedMilliseconds;

            var completions = GetModules(glyphService, Text);
            var res         = new PythonCompletionSet(Text, Text, Span, completions, new Completion[0]);

            var end = _stopwatch.ElapsedMilliseconds;

            if (/*Logging &&*/ end - start > TooMuchTime)
            {
                Trace.WriteLine(String.Format("{0} lookup time {1} for {2} imports", this, end - start, res.Completions.Count));
            }

            return(res);
        }
        public override CompletionSet GetCompletions(IGlyphService glyphService)
        {
            var start1 = _stopwatch.ElapsedMilliseconds;

            MemberResult[] members = null;
            IReplEvaluator eval;
            IDlrEvaluator dlrEval;
            if (_snapshot.TextBuffer.Properties.TryGetProperty<IReplEvaluator>(typeof(IReplEvaluator), out eval) &&
                (dlrEval = eval as IDlrEvaluator) != null) {
                string text = Text;
                if(Text.EndsWith(".")) {
                    text = Text.Substring(0, Text.Length - 1);
                }
                var memberNames = dlrEval.GetMemberNames(text);

                if (memberNames != null && memberNames.Count > 0) {
                    members = new MemberResult[memberNames.Count];
                    int i = 0;
                    foreach(var member in memberNames) {
                        members[i++] = new MemberResult(member.Name, GetMemberType(member));
                    }
                }
            }

            if (members == null) {
                var analysis = GetAnalysisEntry();
                if (analysis != null) {
                    members = analysis.GetMembers(
                        Text,
                        _snapshot.GetLineNumberFromPosition(_pos) + 1,
                        _intersectMembers).ToArray();
                } else {
                    members = new MemberResult[0];
                }
            }

            members = DoFilterCompletions(members);
            Array.Sort(members, ModuleSort);

            var end = _stopwatch.ElapsedMilliseconds;

            if (/*Logging &&*/ (end - start1) > TooMuchTime) {
                Trace.WriteLine(String.Format("{0} lookup time {1} for {2} members", this, end - start1, members.Length));
            }

            var start = _stopwatch.ElapsedMilliseconds;

            var result = new PythonCompletionSet(
                Text,
                Text,
                _snapshot.CreateTrackingSpan(_pos, 0, SpanTrackingMode.EdgeInclusive),
                TransformMembers(glyphService, members),
                new Completion[0]);

            end = _stopwatch.ElapsedMilliseconds;

            if (/*Logging &&*/ (end - start1) > TooMuchTime) {
                Trace.WriteLine(String.Format("{0} completion set time {1} total time {2}", this, end - start, end - start1));
            }

            return result;
        }
示例#4
0
        public override CompletionSet GetCompletions(IGlyphService glyphService)
        {
            var start1 = _stopwatch.ElapsedMilliseconds;

            MemberResult[] members = null;
            IReplEvaluator eval;
            IDlrEvaluator  dlrEval;

            if (_snapshot.TextBuffer.Properties.TryGetProperty <IReplEvaluator>(typeof(IReplEvaluator), out eval) &&
                (dlrEval = eval as IDlrEvaluator) != null)
            {
                string text = Text;
                if (Text.EndsWith("."))
                {
                    text = Text.Substring(0, Text.Length - 1);
                }
                var memberNames = dlrEval.GetMemberNames(text);

                if (memberNames != null && memberNames.Count > 0)
                {
                    members = new MemberResult[memberNames.Count];
                    int i = 0;
                    foreach (var member in memberNames)
                    {
                        members[i++] = new MemberResult(member.Name, GetMemberType(member));
                    }
                }
            }

            if (members == null)
            {
                var analysis = GetAnalysisEntry();
                if (analysis != null)
                {
                    members = analysis.GetMembers(
                        Text,
                        _snapshot.GetLineNumberFromPosition(_pos) + 1,
                        _intersectMembers).ToArray();
                }
                else
                {
                    members = new MemberResult[0];
                }
            }

            members = DoFilterCompletions(members);
            Array.Sort(members, ModuleSort);

            var end = _stopwatch.ElapsedMilliseconds;

            if (/*Logging &&*/ (end - start1) > TooMuchTime)
            {
                Trace.WriteLine(String.Format("{0} lookup time {1} for {2} members", this, end - start1, members.Length));
            }

            var start = _stopwatch.ElapsedMilliseconds;

            var result = new PythonCompletionSet(
                Text,
                Text,
                _snapshot.CreateTrackingSpan(_pos, 0, SpanTrackingMode.EdgeInclusive),
                TransformMembers(glyphService, members),
                new Completion[0]);

            end = _stopwatch.ElapsedMilliseconds;

            if (/*Logging &&*/ (end - start1) > TooMuchTime)
            {
                Trace.WriteLine(String.Format("{0} completion set time {1} total time {2}", this, end - start, end - start1));
            }

            return(result);
        }