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()); }
public IEnumerable <CompletionItem> GetCompletion(int position, char triggerChar) { var completionTrigger = CompletionTriggerInfo.CreateTypeCharTriggerInfo(triggerChar); var completionProviders = _completionService.GetDefaultCompletionProviders(); var groups = _completionService.GetGroups( CurrentScript, position, completionTrigger, completionProviders, CancellationToken.None); if (groups == null) { yield break; } foreach (var completionItem in groups.SelectMany(x => x.Items)) { yield return(completionItem); } }