Example #1
0
    private async Task InterpretKeyPress(KeyPress key, CodePane codePane, CompletionPane completionPane, CancellationToken cancellationToken)
    {
        if (!completionPane.WouldKeyPressCommitCompletionItem(key))
        {
            key = await promptCallbacks.TransformKeyPressAsync(codePane.Document.GetText(), codePane.Document.Caret, key, cancellationToken).ConfigureAwait(false);
        }

        foreach (var panes in new IKeyPressHandler[] { completionPane, history, codePane })
        {
            await panes.OnKeyDown(key, cancellationToken).ConfigureAwait(false);
        }

        foreach (var panes in new IKeyPressHandler[] { completionPane, history, codePane })
        {
            await panes.OnKeyUp(key, cancellationToken).ConfigureAwait(false);
        }

        //we don't support text selection while completion list is open
        //text selection can put completion list into broken state, where filtering does not work
        //so we want this assert to be true
        Debug.Assert(!completionPane.IsOpen || (codePane.Selection is null));
    }