Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to access mouse events in a Visual Studio Code extension

Tags:

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.

like image 225
Greg Harley Avatar asked Mar 21 '16 18:03

Greg Harley


People also ask

How do I get multiple cursors in VS Code?

VS Code supports multiple cursors for fast simultaneous edits. You can add secondary cursors (rendered thinner) with Alt+Click. Each cursor operates independently based on the context it sits in. A common way to add more cursors is with Shift+Alt+Down or Shift+Alt+Up that insert cursors below or above.

How do you navigate in VS Code?

Hold Ctrl and press Tab to view a list of all files open in an editor group. To open one of these files, use Tab again to pick the file you want to navigate to, then release Ctrl to open it. Alternatively, you can use Ctrl+Alt+- and Ctrl+Shift+- to navigate between files and edit locations.

How do I change my mouse cursor in VS Code?

You can also press ctrl + shift + I . In mac os it is control.


1 Answers

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).

like image 131
Niels Bom Avatar answered Oct 19 '22 18:10

Niels Bom