VSCode设置bash处理

  本文转载自:王老师文章:  VSCode设置bash处理

  其他扩展知识文章:变量参考:https://code.visualstudio.com/docs/editor/variables-reference

             VSCode插件:Command Variable

           宏:https://baike.baidu.com/item/%E5%AE%8F/2648286

以下是正文:

VSCode设置bash处理

 

全局VS Code设置文件路径:C:UserswypAppDataRoamingCodeUsersettings.json

vscode—修改默认的shell

1、修改默认的shell的方法步骤:

  1.  Ctrl + Shift + P : 调出命令输入框

  2.  输入 Terminal: Select Default Shell 

  3.  输入要使用的 shell 或者选择也可,例如:

 在C:UserswypAppDataRoamingCodeUsersettings.json文件里,设置 -l 参数,需要配置环境变量Path的值为bash所在的路径,-l 表示登录,可以获取环境变量信息。

"terminal.integrated.shell.windows": "C:\Program Files\Git\bin\bash.exe",
"terminal.integrated.shellArgs.windows": [ "-l" ],

配置好终端使用shell之后,就可以测试一下linux命令了:

2、打开vscode 的设置git路径:

 输入:git.p

这里面有一个git.path,设置 git.exe 文件所在的路径,

"git.defaultCloneDirectory": "",
"git.path": "C:\Program Files\Git\bin\git.exe"

最终设置之后的截图:

3、每个项目具体的VS Code设置:例如:设置IDE字体大小

.vscodesettings.json 文件内容

{
    "editor.fontFamily": "JetBrains Mono",
    "editor.fontSize": 14,
    "editor.fontLigatures": "true",
    "editor.fontWeight": "normal",
    "debug.console.fontFamily": "Fira Code,JetBrains Mono",
    "scm.inputFontFamily": "Fira Code,JetBrains Mono",
    "terminal.integrated.fontFamily": "Fira Code,JetBrains Mono",
    "rest-client.fontFamily": "Fira Code,JetBrains Mono",
    "rest-client.fontSize": 15,
    "window.zoomLevel": 1.0,
    "window.autoDetectColorScheme": true,
    "workbench.colorTheme": "Night Owl (No Italics)",
    "workbench.tree.indent": 16
}

4、安装command-variable插件

设置执行.vscodelaunch.json,.vscodetasks.json可以用到自定义宏(例如:解决方案文件夹路径),等用于VS2019里面的宏。

task.json 文件内容

复制代码
  1 {
  2   // See https://go.microsoft.com/fwlink/?LinkId=733558
  3   // for the documentation about the tasks.json format
  4   "version": "2.0.0",
  5   "tasks": [
  6     {
  7       "label": "copy-template-wwwroot",
  8       "command": "${command:extension.commandvariable.workspace.workspaceFolderPosix}/build/template-copy",
  9       "args": [
 10         "${command:extension.commandvariable.workspace.workspaceFolderPosix}"
 11       ],
 12       "type": "shell",
 13       "group": "build",
 14       "presentation": {
 15         "reveal": "silent"
 16       },
 17       "problemMatcher": "$msCompile"
 18     },
 19     {
 20       "label": "template-1000",
 21       "command": "${command:extension.commandvariable.workspace.workspaceFolderPosix}/build/template-build",
 22       "args": [
 23         "${command:extension.commandvariable.workspace.workspaceFolderPosix}",
 24         "1000"
 25       ],
 26       "type": "shell",
 27       "group": "build",
 28       "presentation": {
 29         "reveal": "silent"
 30       },
 31       "problemMatcher": "$msCompile"
 32     },
 33     {
 34       "label": "template-1001",
 35       "command": "${command:extension.commandvariable.workspace.workspaceFolderPosix}/build/template-build",
 36       "args": [
 37         "${command:extension.commandvariable.workspace.workspaceFolderPosix}",
 38         "1001"
 39       ],
 40       "type": "shell",
 41       "group": "build",
 42       "presentation": {
 43         "reveal": "silent"
 44       },
 45       "problemMatcher": "$msCompile"
 46     },
 47     {
 48       "label": "template-1002",
 49       "command": "${command:extension.commandvariable.workspace.workspaceFolderPosix}/build/template-build",
 50       "args": [
 51         "${command:extension.commandvariable.workspace.workspaceFolderPosix}",
 52         "1002"
 53       ],
 54       "type": "shell",
 55       "group": "build",
 56       "presentation": {
 57         "reveal": "silent"
 58       },
 59       "problemMatcher": "$msCompile"
 60     },
 61     {
 62       "label": "template-1003",
 63       "command": "${command:extension.commandvariable.workspace.workspaceFolderPosix}/build/template-build",
 64       "args": [
 65         "${command:extension.commandvariable.workspace.workspaceFolderPosix}",
 66         "1003"
 67       ],
 68       "type": "shell",
 69       "group": "build",
 70       "presentation": {
 71         "reveal": "silent"
 72       },
 73       "problemMatcher": "$msCompile"
 74     },
 75 
 76     {
 77       "label": "build-template",
 78       "command": "${command:extension.commandvariable.workspace.workspaceFolderPosix}/build/template-build",
 79       "args": [
 80         "${command:extension.commandvariable.workspace.workspaceFolderPosix}"
 81       ],
 82       "type": "shell",
 83       "group": "build",
 84       "presentation": {
 85         "reveal": "silent"
 86       },
 87       "problemMatcher": "$msCompile"
 88     },
 89     {
 90       "label": "build-www",
 91       "command": "dotnet",
 92       "type": "shell",
 93       "args": [
 94         "build",
 95         "-p:SkipPostBuild=True",
 96         "${command:extension.commandvariable.workspace.workspaceFolderPosix}/meshop/MeShop.View.WWW/MeShop.View.WWW.csproj"
 97       ],
 98       "group": "build",
 99       "presentation": {
100         "reveal": "silent"
101       },
102       "dependsOn":["build-template"],
103       "problemMatcher": "$msCompile"
104     }
105   ]
106 }
复制代码

launch.json 文件内容

复制代码
 1 {
 2     // 使用 IntelliSense 了解相关属性。 
 3     // 悬停以查看现有属性的描述。
 4     // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
 5     "version": "0.2.0",
 6     "configurations": [
 7         {
 8             "name": "meshop-www",
 9             "type": "coreclr",
10             "request": "launch",
11             "preLaunchTask": "build-www",
12             "program": "${workspaceFolder}/meshop/MeShop.View.WWW/bin/Debug/MeShop.View.WWW.dll",
13             "args": [
14 
15             ],
16             "cwd": "${workspaceFolder}/meshop/MeShop.View.WWW",
17             "stopAtEntry": false,
18             "serverReadyAction": {
19                 "action": "openExternally",
20                 "pattern": "\bNow listening on:\s+(https?://\S+)"
21             },
22             "requireExactSource": false,
23             "env": {
24                 "HOST_ADMIN": "deverr",
25                 "ASPNETCORE_ENVIRONMENT": "Development",
26                 "MESHOP_CDN": "cdn.meshop.net"
27             },
28             "sourceFileMap": {
29                 "/Views": "${workspaceFolder}/Views"
30             }
31         }
32     ]
33 }
复制代码

 

*感谢您的阅读。喜欢的、有用的就请大哥大嫂们高抬贵手“推荐一下”吧!你的精神 支持是博主强大的写作动力。欢迎转载!
*博主的文章是自己平时开发总结的经验,由于博主的水平不高,不足和错误之处在所难免,希望大家能够批评指出。
*我的博客: http://www.cnblogs.com/lxhbky/
原文地址:https://www.cnblogs.com/lxhbky/p/14644931.html