简体   繁体   中英

How to detect copy and cut actions in visual studio code extensions?

I develop a vscode extension.
I would like to decect user action for copy and cut on the editor.

I checked API reference , but I could not find the method.

How can I do this in extensions with typescript ?

You are right, there is no API for that, and by VSCode Approach to Extensibility , you may be out of luck.

I had tried to replace the original Copy and Cut commands, but ended up creating new commands and adding instructions to the user to replace the keybindings, when I created my Copy Word in Cursor extension. I had issues because VSCode itself does not publish a Clipboard object (compared to Atom), so I had to do myself, using node-copy-paste package.

Unless they have changed its idea (try to open an issue on VSCode repo), you should create new Copy and Cut commands to accomplish what your extension needs to do.


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM