SuggestionBase.OnProposalUpdatedAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
There has been some change (typically a change in the text buffer) that has caused a change in the proposal.
public abstract System.Threading.Tasks.Task OnProposalUpdatedAsync (Microsoft.VisualStudio.Language.Suggestions.SuggestionSessionBase session, Microsoft.VisualStudio.Language.Proposals.ProposalBase? originalProposal, Microsoft.VisualStudio.Language.Proposals.ProposalBase? currentProposal, Microsoft.VisualStudio.Language.Suggestions.ReasonForUpdate reason, Microsoft.VisualStudio.Text.VirtualSnapshotPoint caret, Microsoft.VisualStudio.Language.Proposals.CompletionState? completionState, System.Threading.CancellationToken cancel);
abstract member OnProposalUpdatedAsync : Microsoft.VisualStudio.Language.Suggestions.SuggestionSessionBase * Microsoft.VisualStudio.Language.Proposals.ProposalBase * Microsoft.VisualStudio.Language.Proposals.ProposalBase * Microsoft.VisualStudio.Language.Suggestions.ReasonForUpdate * Microsoft.VisualStudio.Text.VirtualSnapshotPoint * Microsoft.VisualStudio.Language.Proposals.CompletionState * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public MustOverride Function OnProposalUpdatedAsync (session As SuggestionSessionBase, originalProposal As ProposalBase, currentProposal As ProposalBase, reason As ReasonForUpdate, caret As VirtualSnapshotPoint, completionState As CompletionState, cancel As CancellationToken) As Task
Parameters
- session
- SuggestionSessionBase
- originalProposal
- ProposalBase
- currentProposal
- ProposalBase
- reason
- ReasonForUpdate
- caret
- VirtualSnapshotPoint
- completionState
- CompletionState
- cancel
- CancellationToken
Returns
Remarks
This method should return quickly. If any substantial work needs to be done, it should be done in an asynchronous task that changes the proposal via DisplayProposalAsync(ProposalBase, CancellationToken).
The suggestion service will attempt to reconcil the proposed edits with any changes the user makes. For example, suppose the original proposal was to insert "red" and the user types "r". In that case the edit will be updated to insert "ed" after the user's typed "r". If the change cannot be reconciled with the user's change, then the most recent version of the proposal will be returned and reason
will have the Diverged flag set.
Note that originalProposal
and currentProposal
may be null. This can happen if users actions cause a quick succession of state changes (e.g. scrolling through the IntelliSense list). In this case, the first change might cause the suggestion provider to clear its proposal -- set it to null -- so that, when the second state change happens, you'll get a ProposalUpdated event for that null proposal.