Ejemplo n.º 1
0
        public override async Task <CompletionChange> GetChangeAsync(Document document, CompletionItem item, char?commitKey = null, CancellationToken cancellationToken = default)
        {
            var change = (await GetTextChangeAsync(document, item, commitKey, cancellationToken).ConfigureAwait(false))
                         ?? new TextChange(item.Span, item.DisplayText);

            return(CompletionChange.Create(change));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the change to be applied when the item is committed.
 /// </summary>
 /// <param name="document">The document that completion is occurring within.</param>
 /// <param name="item">The item to get the change for.</param>
 /// <param name="commitCharacter">The typed character that caused the item to be committed.
 /// This character may be used as part of the change.
 /// This value is null when the commit was caused by the [TAB] or [ENTER] keys.</param>
 /// <param name="cancellationToken"></param>
 public virtual Task <CompletionChange> GetChangeAsync(
     Document document,
     CompletionItem item,
     char?commitCharacter = null,
     CancellationToken cancellationToken = default)
 {
     return(Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText))));
 }
Ejemplo n.º 3
0
        public override async Task <CompletionChange> GetChangeAsync(
            Document document, CompletionItem item, char?commitKey, CancellationToken cancellationToken)
        {
            var provider = GetProvider(item);

            if (provider != null)
            {
                return(await provider.GetChangeAsync(document, item, commitKey, cancellationToken).ConfigureAwait(false));
            }
            else
            {
                return(CompletionChange.Create(new TextChange(item.Span, item.DisplayText)));
            }
        }