Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Line NumberNew to Visual Studio Code? Get it now.

Line Number

Liangru Liu

|
124 installs
| (0) | Free
Copy formatted text with line numbers
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Line Number

VS Market Version VS Market Last Updated VS Market Installs (Static) Extension's Keywords

展开 中文版介绍

这个插件可以给代码添加行号。
它比同类插件的优点是,能保留代码原本的颜色。
首先声明,它目前还不够完善,详见 文末。

截图

  • 略

前言及简介

  • 在向 Word 等富文本编辑器中粘贴代码时,会有带行号粘贴的需求。
  • 插件市场中那些生成行号的插件,要么是只能粘贴纯文本,要么是重新给代码着色而不能保留在 VSCode 中的颜色。
  • 本插件不仅能实现保留原本的颜色,还提供了一些个性化选项。

安装与使用

  1. 点击 VSCode 左侧扩展按钮,在搜索框搜索,点击 [安装]。
  2. 在 命令面板 中执行 Line Number: Open Panel,打开处理面板。
  3. 在处理面板上方设置好参数,从 VSCode 的编辑窗口复制所需代码,粘贴到处理面板,会立刻生成行号并自动复制,之后去所需位置粘贴即可。

说明

  1. 插件代码所在位置为(Windows 上的默认路径):
    C:/Users/<NAME>/.vscode/extensions/liangruliu.line-number-<VER>
  2. 这个插件存在三个缺点: 一是只能处理来自 VSCode 的内容, 二是对未知语言(即无着色的代码)和部分第三方颜色主题可能无法支持, 三是操作略显繁琐且配置不能保存。
  3. 制作这个插件存在一个难点:Node.js 和 VSCode 所提供的读取剪贴板功能,似乎只能读到纯内容而无法得到富文本。
    所以我把插件做成一个处理面板的形式,其实不是为了有预览功能什么的,而是因为能够利用到操作系统的复制粘贴功能。
    如果你有解决这个问题的思路,或者有什么建议,欢迎通过邮箱 LiangruLiu@outlook.com 与我联系。

开启个性化的 VSCode!





英文版介绍

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

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

  1. Click the extension button on the left side of VSCode, search in the search box, and click [install].
  2. Execute Line Number: Open Panel in the Command Panel to open the processing panel.
  3. 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

  1. The location of the plugin code is (Default path on Windows):
    C:/Users/<NAME>/.vscode/extensions/liangruliu.line-number-<VER>
  2. 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.
  3. 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.

Enjoy!



  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft