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

            return(CompletionChange.Create(change));
        }
示例#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(CancellationToken))
 {
     return(Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText))));
 }
示例#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)));
            }
        }
 /// <summary>
 /// Gets the change to be applied when the specified item is committed.
 /// </summary>
 /// <param name="document">The current document.</param>
 /// <param name="item">The item to be committed.</param>
 /// <param name="commitKey">The optional key character that caused the commit.</param>
 /// <param name="cancellationToken"></param>
 public virtual Task <CompletionChange> GetChangeAsync(
     LogicalDocument document, CompletionItem item, char?commitKey, CancellationToken cancellationToken)
 {
     return(Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText))));
 }