美文网首页Flutter
绿化 VSCode 开发环境 - Windows 篇

绿化 VSCode 开发环境 - Windows 篇

作者: RJ_Hwang | 来源:发表于2019-07-22 20:33 被阅读0次
    1. 从官网下载绿色版的 zip 包

      VSCode-win32-x64-1.36.1.zip

    2. 解压 VSCode-win32-x64-1.36.1.zip 到目录 <vscode-install-dir>
    3. <vscode-install-dir>/bin 添加到系统环境变量 Path

      这样才能在命令行使用 code 命令。

    4. 给文件资源管理器添加右键菜单
      将下面的内容保存为 vsCodeOpenFolder.reg 文件,然后双击执行导入到注册表中,注意要将内容中的 <vscode-install-dir> 更改为实际的安装路径:
      Windows Registry Editor Version 5.00
      
      ; Open files
      [HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
      @="Edit with VS Code"
      "Icon"="<vscode-install-dir>\\Code.exe,0"
      
      [HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
      @="\"<vscode-install-dir>\\Code.exe\" \"%1\""
      
      ; This will make it appear when you right click ON a folder
      ; The "Icon" line can be removed if you don't want the icon to appear
      
      [HKEY_CLASSES_ROOT\Directory\shell\vscode]
      @="Open Folder as VS Code Project"
      "Icon"="\"<vscode-install-dir>\\Code.exe\",0"
      
      [HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
      @="\"<vscode-install-dir>\\Code.exe\" \"%1\""
      
      ; This will make it appear when you right click INSIDE a folder
      ; The "Icon" line can be removed if you don't want the icon to appear
      
      [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode]
      @="Open Folder as VS Code Project"
      "Icon"="\"<vscode-install-dir>\\Code.exe\",0"
      
      [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
      @="\"<vscode-install-dir>\\Code.exe\" \"%V\""
      

      例:<vscode-install-dir>=D:\\green\\vscode\\VSCode-win32-x64-latest

    5. 更改配置数据、扩展的保存路径
      创建 <vscode-install-dir>/data 目录即可,这样 vscode 所有的数据,包括会话状态、配置、扩展等数据都会保存在此目录下。官方说明文档详见 这里
      Portable 模式仅适用于绿色版的安装,不适用于安装版。
      启用 Portable 模式后,data 的目录结构如下:
      |- VSCode-win32-x64-latest
      |   |- Code.exe
      |   |- data
      |   |   |- user-data    // 对应 "%APPDATA%\Code" 目录
      |   |   |   |- ...
      |   |   |- extensions   // 对应 "%USERPROFILE%\.vscode\extensions" 目录
      |   |   |   |- ...
      |   |   |- tmp          // 对应系统的临时目录
      |   |- ...
      

      此方法的好处是当你解压安装了新的绿色版本后,将旧版的 data 目录拷贝过去即可。

    相关文章

      网友评论

        本文标题:绿化 VSCode 开发环境 - Windows 篇

        本文链接:https://www.haomeiwen.com/subject/midglctx.html