public DaxCompletionSource(ITextBuffer buffer, IGlyphService glyphService, ICompletionDataSnaphotProvider completionDataProvider)
 {
     _buffer                 = buffer;
     _glyphService           = glyphService;
     _completionDataProvider = completionDataProvider;
     _completionIconSource   = new CompletionIconSource(_glyphService);
 }
        public IEnumerable <Completion> GetCompletionData(CompletionIconSource completionIconSource)
        {
            if (_sortedCompletion == null)
            {
                var completions = new List <Completion>();
                completions.AddRange(GetKeywordCompletionDataList(completionIconSource));
                completions.AddRange(GetFunctionCompletionDataList(completionIconSource));
                completions.AddRange(GetTableCompletionDataList(completionIconSource));

                completions.Sort((i, k) => string.Compare(i.DisplayText, k.DisplayText));
                _sortedCompletion = completions;
            }

            return(_sortedCompletion);
        }
        private IEnumerable <Completion> GetTableCompletionDataList(CompletionIconSource completionIconSource)
        {
            var completions = new List <Completion>();

            foreach (var table in _tables)
            {
                completions.Add(new Completion()
                {
                    DisplayText        = table,
                    InsertionText      = table,
                    Description        = table,
                    IconSource         = completionIconSource.GetTableImage(),
                    IconAutomationText = null,
                });
            }
            ;

            foreach (var column in _columnList)
            {
                completions.Add(new Completion()
                {
                    DisplayText        = column,
                    InsertionText      = column,
                    Description        = column,
                    IconSource         = completionIconSource.GetColumnImage(),
                    IconAutomationText = null,
                });
            }
            ;

            foreach (var measure in _measureList)
            {
                completions.Add(new Completion()
                {
                    DisplayText        = measure,
                    InsertionText      = measure,
                    Description        = measure,
                    IconSource         = completionIconSource.GetMeasureImage(),
                    IconAutomationText = null,
                });
            }
            ;

            return(completions);
        }
        private IEnumerable <Completion> GetFunctionCompletionDataList(CompletionIconSource completionIconSource)
        {
            var completions = new List <Completion>();

            foreach (var function in _functions)
            {
                completions.Add(new Completion()
                {
                    DisplayText        = function.Name,
                    InsertionText      = function.Name,
                    Description        = function.Description,
                    IconSource         = completionIconSource.GetFunctionImage(),
                    IconAutomationText = null,
                });
            }
            ;

            return(completions);
        }
        private IEnumerable <Completion> GetKeywordCompletionDataList(CompletionIconSource completionIconSource)
        {
            var completions = new List <Completion>();

            foreach (var keyword in _keywords)
            {
                completions.Add(new Completion()
                {
                    DisplayText        = keyword.Name,
                    InsertionText      = keyword.Name,
                    Description        = keyword.Description,
                    IconSource         = completionIconSource.GetKeywordImage(),
                    IconAutomationText = null,
                });
            }
            ;

            return(completions);
        }