vscode: `editor.action.clipboardPasteAction` doesn't work with `runCommands`

Type: Bug

  1. Define following keybinding in keybindings.json.
    {
        "key": "ctrl+p",
        "command": "runCommands",
        "args": {
            "commands": [
                { "command": "editor.action.clipboardPasteAction" },
                { "command": "type", "args": { "text": "," }}
            ]
        }
    },
  1. Copy some string like ‘hello’ to the clipboard.
  2. In a text editor, press Ctrl+P.

Expected behavior is hello, inserted to the document. Actual result is , only.

VS Code version: Code 1.81.1 (6c3e3dba23e8fadc360aed75ce363ba185c49794, 2023-08-09T22:22:42.175Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info
Item Value
CPUs AMD Ryzen Threadripper 3970X 32-Core Processor (64 x 3693)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) undefined
Memory (System) 127.88GB (97.14GB free)
Process Argv .
Screen Reader no
VM 0%
Extensions: none

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

@ulugbekna

Do you mean that you had a shortcut that uses runCommands with editor.action.clipboardPasteAction that worked correctly but now it doesn’t? (ie it may be a regression related to editor.aciton.clipboardPasteAction)

Correct.


@vkoshcheev

This issue has nothing to do with clipboardPasteAction, runCommands is bugged and only executes last command.

My keyboard shortcut looks like this:

{
  "key": "ctrl+m ctrl+l",
  "command": "runCommands",
  "args": {
      "commands": [
          "editor.action.insertCursorAtEndOfEachLineSelected",
          "cursorHome",
          "cursorWordEndRightSelect",
          { "command": "type", "args": { "text": "-" } },
          "cursorEnd",
          "deleteLeft",
          "cursorWordLeft",
          "cursorWordLeftSelect",
          "deleteLeft",
          "cursorWordEndRightSelect",
          "editor.action.clipboardCutAction",
          { "command": "type", "args": { "text": "[#" } },
          "editor.action.clipboardPasteAction",
          "cursorRight",
          { "command": "type", "args": { "text": "(https://github.com/my/repo/issues/" } },
          "editor.action.clipboardPasteAction",
          "cursorRight",
          { "command": "type", "args": { "text": " by @" } }
      ]
  }

Every step works except the two editor.action.clipboardPasteAction actions.

Even the editor.action.clipboardCutAction step works, as I mentioned I can manually paste afterwards.