private onKeyDown()

in Clients/Xamarin.Interactive.Client/ClientApp/workbook/code-editor.ts [219:240]


  private onKeyDown(e: monaco.IKeyboardEvent) {
    if (this.isCompletionWindowVisible())
      return

    let cancel = false

    if (e.keyCode == monaco.KeyCode.Enter && this.options.onEnter)
      cancel = this.options.onEnter(e.shiftKey, e.metaKey, e.ctrlKey)
    else if (e.keyCode == monaco.KeyCode.UpArrow && !e.shiftKey && !e.metaKey && this.options.onCursorUpDown && !this.isParameterHintsWindowVisible())
      cancel = this.options.onCursorUpDown(true)
    else if (e.keyCode == monaco.KeyCode.DownArrow && !e.shiftKey && !e.metaKey  && this.options.onCursorUpDown && !this.isParameterHintsWindowVisible())
      cancel = this.options.onCursorUpDown(false)
    else if (e.metaKey && (
      ((e.keyCode == monaco.KeyCode.US_CLOSE_SQUARE_BRACKET || e.keyCode == monaco.KeyCode.US_OPEN_SQUARE_BRACKET) && e.shiftKey) ||
      e.keyCode == monaco.KeyCode.KEY_G))
      e.stopPropagation()

    if (cancel) {
      e.preventDefault()
      e.stopPropagation()
    }
  }