This plugin can add line numbers to code.
Its advantage over similar plugins is that it retains the original color of the code.
First of all, it's not perfect at present, see end of article for details.
Screenshot
Preface & Introduction
When pasting code into rich text editors such as Word, there will be a need to paste with line numbers.
Plugins in the marketplace that generate line numbers either can only paste plain text, or recolor the code and not keep the colors in VSCode.
This plugin can not only keep the original colors, but also provide some personalization options.
Installation & Usage
Click the extension button on the left side of VSCode, search in the search box, and click [install].
Set the parameters above the processing panel, copy the code you want from the editing window of VSCode, paste it into the processing panel, the line number will be generated immediately and automatically copied, then you can paste it to the desired location.
Description
The location of the plugin code is (Default path on Windows): C:/Users/<NAME>/.vscode/extensions/liangruliu.line-number-<VER>
This plugin has three disadvantages:
one is that it can only process content from VSCode,
the other is that it may not support unknown languages (that is, uncolored code) and some third-party color themes,
and the third is that the operation is slightly cumbersome and the configuration cannot be saved.
There is a difficulty in making this plugin: the read clipboard function provided by Node.js and VSCode seems to only read plain content and cannot get rich text.
So I made the plugin in the form of a processing panel, not to have a preview function or something, but to be able to use the copy and paste function of the operating system.
If you have ideas to solve this problem or have any suggestions, feel free to contact me via email LiangruLiu@outlook.com.