Пример #1
0
        public bool IsCompletionTriggerCharacter(int position)
        {
            var currentScriptText   = CurrentScript.GetText();
            var completionProviders = _completionService.GetDefaultCompletionProviders();

            return(_completionService.IsTriggerCharacter(currentScriptText, position, completionProviders));
        }
Пример #2
0
        public IList <CompletionItem> GetCompletion(int position, string text = null)
        {
            CompletionTriggerInfo triggerInfo;

            if (!string.IsNullOrEmpty(text))
            {
                triggerInfo = CompletionTriggerInfo.CreateTypeCharTriggerInfo(char.Parse(text));
            }
            else
            {
                triggerInfo = CompletionTriggerInfo.CreateInvokeCompletionTriggerInfo();
            }

            var groups = _completionService.GetGroups(GetCurrentDocument(), position,
                                                      triggerInfo,
                                                      _completionService.GetDefaultCompletionProviders(),
                                                      CancellationToken.None);

            return((groups ?? Enumerable.Empty <CompletionItemGroup>()).SelectMany(t => t.Items).OrderByDescending(t => t.SortText).ToArray());
        }