V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
klesh
V2EX  ›  分享创造

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

  •  
  •   klesh · 2019-11-24 20:55:36 +08:00 · 2498 次点击
    这是一个创建于 1586 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    需要将

    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

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3360 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:17 · PVG 21:17 · LAX 06:17 · JFK 09:17
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.