28

I would like to write a simple extension for Visual Studio Code to allow basic drag and drop copy/paste functionality but I can't find any way to be notified of mouse events. Have I overlooked something obvious or has the editor intentionally been designed to be keyboard only (well mostly)?

Note: I am referring to the TypeScript based Visual Studio Code editor not the full-blown Visual Studio.

EDIT: I should have phrased the question differently because there is indeed drag and drop copy/paste now, but it's still not clear to me how to handle mouse events in an extension.

Greg Harley
  • 433
  • 3
  • 10
  • I believe the latest build has drag and drop editing (but I'm not completely sure since that's not a feature I use). – Bill_Stewart Mar 11 '17 at 12:10
  • The latest version does indeed allowing moving selected text with the mouse but not copying for some reason. Also, unless I've missed something, it appears there is still no way to capture mouse events in an extension. – Greg Harley Mar 14 '17 at 18:22
  • I've run into this issue today and it's look like there still is no option to customize mouse shortcuts and to use it in extensions. – Adrian Bystrek Aug 22 '17 at 12:22
  • same here using tree view - I don't think there's an API to control tree nodes drag&drop etc without using webview. In my case I can replace drag&drop with a very ugly UX based on clicks. vscode and typescript are GREAT products but I feel they are prioritizing end user requirements and not the extensions APIs (and that's OK) - in the case of vscode I would expect that components like the file explorer, search, etc to be extensions (eat your own sh$t) using the same APIs offered to users like me.. but of course that would make development slow. – cancerbero Jun 08 '18 at 03:27
  • 1
    This is already supported in the latest VS Code, just select the text you want to copy, drag and drop it with the `CTRL` button pressed, it will be copied to the place you want. but it can only be used in the same file, you cannot copy to another file. – Jiayin Pei Feb 09 '21 at 01:46
  • It's usually a sourcemap issue. [This post explains how to enable and work with them.](https://stackoverflow.com/questions/40003070/how-to-configure-source-maps-when-using-jest-within-visual-studio-code-debugger). Also: Make sure to use Node@16 or above, since source map support has much improved since then. – Domi May 21 '21 at 17:48

1 Answers1

1

No.

There are currently (2021) no API features that allow for hooking into drag and drop mouse events.

In general, if you want to let an extension hook into things happening in VS Code you can do so by subscribing to certain events (search for "events" on that page).

Niels Bom
  • 8,728
  • 11
  • 46
  • 62