提交 6c5faa65 编写于 作者: C CyrusNajmabadi

Only filter if it's a retrigger command.

上级 a3d95169
......@@ -9,10 +9,14 @@ internal partial class Controller
{
internal partial class Session : Session<Controller, Model, ISignatureHelpPresenterSession>
{
// When we issue compute tasks, provide them with a (monotonically increasing) id. That
// way, when they run we can bail on computation if they've been superseded by another
// compute task.
private int _computeId;
/// <summary>
/// When ther user moves the caret we issue retrigger commands. There may be a long
/// chain of these, and they may take time for each to process. This can be visible
/// to the user as a long delay before the signature help items update. To avoid this
/// we keep track if there is new outstanding retrigger command and we bail on the
/// computation if another is in the queue.
/// </summary>
private int _retriggerId;
public Session(Controller controller, ISignatureHelpPresenterSession presenterSession)
: base(controller, new ModelComputation<Model>(controller, TaskScheduler.Default), presenterSession)
......
......@@ -39,8 +39,12 @@ internal partial class Session
var caretPosition = Controller.TextView.GetCaretPoint(Controller.SubjectBuffer).Value;
var disconnectedBufferGraph = new DisconnectedBufferGraph(Controller.SubjectBuffer, Controller.TextView.TextBuffer);
Interlocked.Increment(ref _computeId);
var localId = _computeId;
if (triggerInfo.TriggerReason == SignatureHelpTriggerReason.RetriggerCommand)
{
Interlocked.Increment(ref _retriggerId);
}
var localId = _retriggerId;
// If we've already computed a model, then just use that. Otherwise, actually
// compute a new model and send that along.
......@@ -196,7 +200,8 @@ private static bool CompareParts(TaggedText p1, TaggedText p2)
// to the extension crashing.
foreach (var provider in providers)
{
if (id != _computeId)
if (triggerInfo.TriggerReason == SignatureHelpTriggerReason.RetriggerCommand &&
id != _retriggerId)
{
return (null, null);
}
......
......@@ -71,9 +71,7 @@ void ICommandHandler<TypeCharCommandArgs>.ExecuteCommand(TypeCharCommandArgs arg
// care of cases where the filtered set of providers didn't provide anything but one of the
// other providers could still be valid, but doesn't explicitly treat the typed character as
// a trigger character.
var filteredProviders = FilterProviders(allProviders, args.TypedChar);
var textuallyTriggeredProviders = filteredProviders.Item1;
var untriggeredProviders = filteredProviders.Item2;
var (textuallyTriggeredProviders, untriggeredProviders) = FilterProviders(allProviders, args.TypedChar);
var triggerInfo = new SignatureHelpTriggerInfo(SignatureHelpTriggerReason.TypeCharCommand, args.TypedChar);
if (!IsSessionActive)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册