Example #1
0
        private IEnumerable <Suggestion> GetCompletions(string text)
        {
            var completions = _cSharpEvaluator.GetCompletions(text).OrderBy(c => c.Text);

            if (completions.Any())
            {
                return(completions);
            }
            return(Enumerable.Empty <Suggestion>());
        }
Example #2
0
        private IEnumerable <Suggestion> GetCompletions(string text, int cursor)
        {
            var codeBlock = GetCodeBlocksIn(text).FirstOrDefault(c => c.SpansIndex(cursor));

            if (codeBlock == null)
            {
                return(Enumerable.Empty <Suggestion>());
            }
            return(_cSharpEvaluator.GetCompletions(codeBlock.Code.RawText).OrderBy(c => c.Text));
        }
        private IEnumerable <Suggestion> GetCompletions(string text)
        {
            var completions = _cSharpEvaluator.GetCompletions(text).OrderBy(c => c.Text);

            if (completions.Any())
            {
                return(completions);
            }

            if (_syntaxProvider.IsPropertyIndicator(text.Last()))
            {
                var word = GetWord(text);
                var obj  = _syntaxProvider.GetType(word);
                if (obj != null)
                {
                    var suggestions = obj.Columns
                                      .OrderBy(p => p.Name)
                                      .Select(property => new Suggestion(property.Name));
                    return(suggestions);
                }
            }
            return(Enumerable.Empty <Suggestion>());
        }