VSC 插件 Selection Converter : 用自定义函数对选中文字进行转换

2019-11-24 20:55:36 +08:00
 klesh

今天写个小玩意的时候,需要做大量的转换。

需要将

export interface TrFile {
   // 下面是从文档上直接 copy 下来的
   "cookies"            | string      pointer to a string of one or more cookies.
   "download-dir"       | string      path to download the torrent to
   "filename"           | string      filename or URL of the .torrent file
   "metainfo"           | string      base64-encoded .torrent content
   "paused"             | boolean     if true, don't start the torrent
   "peer-limit"         | number      maximum number of peers
   "bandwidthPriority"  | number      torrent's bandwidth tr_priority_t
   "files-wanted"       | array       indices of file(s) to download
   "files-unwanted"     | array       indices of file(s) to not download
   "priority-high"      | array       indices of high-priority file(s)
   "priority-low"       | array       indices of low-priority file(s)
   "priority-normal"    | array       indices of normal-priority file(s)
}

转换成:

export interface TrFile {
  // 下面是转换后的
  "cookies": string               // pointer
  "download-dir": string          // path
  "filename": string              // filename
  "metainfo": string              // base64-encoded
  "paused": boolean               // if
  "peer-limit": number            // maximum
  "bandwidthPriority": number     // torrent's
  "files-wanted": array           // indices
  "files-unwanted": array         // indices
  "priority-high": array          // indices
  "priority-low": array           // indices
  "priority-normal": array        // indices
}

找了半天没有合适的工具, 因此自己撸了一个插件来调用自定义函数对选中文件进行修改。

插件地址: https://marketplace.visualstudio.com/items?itemName=kleshwong.selection-converter

2539 次点击
所在节点    分享创造
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/622698

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX