肌张力是什么意思| 脚麻什么原因| 我行我素是什么意思| 东盟是什么意思| 正切是什么| 毒龙钻是什么| 开门杀是什么意思| 截胡什么意思| coat是什么意思中文| 海石花是什么| 女人耳垂大厚代表什么| 前列腺肥大是什么原因引起| 立加羽读什么| 出汗有盐霜是什么原因| 流是什么意思| 试纸什么时候用最准确| 豌豆什么时候种最好| 糖尿病病人吃什么水果| 羁押是什么意思| 什么的脊背| 柳树像什么| 什么样的女人容易出轨| 太平果是什么水果| 喝水经常呛到是什么原因| 苏州有什么好玩的地方| 梦见小牛犊是什么预兆| 40年属什么| 氯化钾是什么| 什么东西抗衰老最好| 女生为什么有喉结| 便秘挂什么科| 儿童办护照需要什么证件| 床头朝向有什么讲究| 紧锣密鼓是什么意思| 上房揭瓦是什么意思| 宝宝老是摇头是什么原因| 梦见假牙掉了是什么意思| 十二生肖它第一是什么生肖| 化验血常规能查出什么| 考教师编制需要什么条件| 做胃镜有什么好处| 清肺吃什么好| visa卡是什么意思| 癞蛤蟆长什么样| 咳嗽咳白痰是什么症状| 永垂不朽的垂是什么意思| babycare是什么牌子| 膏肓是什么意思| 肾炎可以吃什么水果| 早泄是什么意思| 晚上吃黄瓜有什么好处| 是什么为什么怎么办| 越字五行属什么| 暗物质和暗能量是什么| 湿疹吃什么水果好| bf是什么牌子| 文定之喜是什么意思| 分家是什么意思| 什么是非处方药| 月经血是黑色的是什么原因| 每次睡觉都做梦为什么| 片仔癀为什么这么贵| 落拓是什么意思| 24k镀金是什么意思| 张什么结什么| 母乳是什么味道| 辅警政审主要审些什么| 心脏房颤是什么意思| 小叶增生吃什么药| 新生儿前面头发稀少是什么原因| 什么人适合吃西洋参| 什么才叫幸福| total什么意思| 黄埔军校现在是什么学校| 黄瓜是什么科| 喉咙痛用什么药好得快| p医学代表什么意思| 巾帼不让须眉是什么意思| 很长很长的什么填空| 什么牌子的蜂蜜比较好| 孕检挂什么科| 产后抑郁一般发生在产后什么时间| 什么叫闭合性跌打损伤| 8月31日什么星座| 水蛭是什么动物| 腰扭伤吃什么药最有效| 房产证改名字需要什么手续| 弥月之喜是什么意思| 明朝为什么会灭亡| 越睡越困是什么原因| 梦见刨红薯是什么意思| 月子期间可以吃什么水果| 癫痫是什么症状| 黑是什么生肖| 去医院看嘴唇挂什么科| 吃什么最补肾| 致电是什么意思| 上火流鼻血是什么原因| 下面痒吃什么消炎药| 婚检都检查什么| 泛醇是什么| 庶子什么意思| 炖羊肉汤放什么调料| 语字五行属什么| 苡是什么意思| 梦见涨大水是什么意思| 太阳穴疼吃什么药| 舌苔发白是什么原因引起的| 杨梅泡酒有什么功效| 越来越瘦是什么原因| 什么是气| 密度单位是什么| 相破是什么意思| 吃火龙果有什么好处和坏处| 6.30什么星座| 草字头下面一个高字读什么| 米线是什么材料做的| 为什么不能天天喝豆浆| 什么的麦子| 头发有点黄是什么原因| 天之骄子是什么意思| 什么食物含蛋白质多| 927什么星座| 百鸟归巢什么意思| 什么是尘肺病| 养狗人容易得什么病| 脾胃虚弱能吃什么水果| 胃胀是什么症状| 巡视员是什么级别| 女性得疱疹是什么症状| 就加鸟念什么| 宝宝干咳嗽是什么原因| 青少年膝盖痛什么原因| 55年出生属什么| 男人吃秋葵有什么好处| 慢性胃炎伴胆汁反流是什么意思| white是什么意思颜色| 什么水果含糖低| 泛醇是什么| 三高挂号挂什么科| 白带黄色是什么原因| offer什么意思| s999是什么意思| 什么东西能让皮肤变白| 床单什么颜色有助于睡眠| 打完升白针有什么反应| 胆结石是什么原因导致的| 什么肉蛋白质含量最高| 相伴是什么意思| 什么样的人容易猝死| 牙痛 吃什么药| 桃胶是什么| 流金是什么字| 挂号是什么意思| 什么手机像素好| 早上十点是什么时辰| papi是什么意思| 咖喱是什么做的| 红色的补色是什么颜色| 佰草集适合什么年龄| 什么中毒查不出来| 同样的药为什么价格相差很多| 吃皮是什么意思| nc是什么意思| 血色素是什么意思| 吃了兔子肉不能吃什么| 心火大吃什么药| 梦见玉碎了是什么意思| 女人为什么会喷水| 高温中暑吃什么药| 读书与吃药是什么生肖| 支数是什么意思| 255是什么意思| adp是什么意思| 夏花是什么意思| 总是嗳气是什么原因| 一直吐口水是什么原因| 脚后跟痛是什么原因| 淀粉和面粉有什么区别| 南红五行属什么| 脑梗前有什么预兆| 什么和什么| 保守治疗是什么意思| 胃疼喝什么能缓解疼痛| 5月20号是什么星座| 月经不调挂什么科室| 刮痧有什么好处| 强龙不压地头蛇是什么生肖| 总胆红素偏高吃什么药| 很能睡觉是什么原因| 女人阳虚吃什么药效果最好| 西红柿不能和什么一起吃| 吃什么补白蛋白最快最好| 比热容是什么| 炸薯条用什么油| 卤蛋是什么意思| 有迹可循什么意思| 火龙果和什么不能一起吃| 嘴边起水泡是什么原因| 什么牌子的辅酶q10好| 玄色是什么颜色| 多梦是什么原因造成的| 茯苓有什么作用和功效| 什么叫射频消融| 一个月来两次例假是什么原因| 打胎后要注意什么| 8.19是什么星座| 梦见好多人是什么意思| 咽炎用什么药好| 经期吃什么补气血| alan英文名什么意思| 孕妇低血压什么补最快| 产妇月子里可以吃什么水果| 冰妹什么意思| 什么是割礼| 新生儿足底采血检查什么项目| 臭屁是什么意思| 为什么会得梅毒| 绝非偶然是什么意思| 尿中泡沫多是什么原因| 节制是什么意思| 二月八号是什么星座| 眩晕症有什么症状| 人参果总皂苷是什么| 三月份是什么星座| 重庆有什么特产| 你本来就很美是什么广告| 谈情说爱是什么意思| 享受低保需要什么条件| 树欲静而风不止是什么意思| 0中间有一横是什么字体| 什么人不能吃茄子| 洁面膏和洗面奶有什么区别| 1990年什么生肖| 尿检粘液丝高什么意思| 无锡机场叫什么名字| 清水文是什么意思| 孕32周需要做什么检查| 人的血压一天中什么时候最高| 感恩节为什么要吃火鸡| 双子座男和什么座最配对| 无量寿佛是什么意思| 扑救带电火灾应选用什么灭火器| 一九七八年属什么生肖| 骨量减少是什么意思| 会阴是什么| 山药什么季节成熟| 非洲人一日三餐吃什么| 眼睛发涩是什么原因导致的| 什么汤降火| 更年期潮热出汗吃什么药| 鸡胸挂什么科| 伶牙俐齿是什么生肖| 1963年发生了什么| 1988属什么生肖| 耳朵会动的人说明什么| 勃起不坚吃什么药| 动爻是什么意思| 神经官能症是什么病| 过敏性皮炎用什么药膏| 经常干呕是什么原因| 舌苔红是什么原因| 妇科腺肌症是什么病| 子宫肌瘤做什么检查| 百度

Try to extend agent mode in VS Code!

劲酒加红牛有什么功能

百度 这些业务包括在线广告,在线交易以及基于用户信息数据的销售业务。

Visual Studio Code supports variable substitution in Debugging and Task configuration files, and for some select settings. Variable substitution is supported inside some key and value strings in launch.json and tasks.json files by using the ${variableName} syntax.

Predefined variables

The following predefined variables are supported:

Variable Description
${userHome} Path of the user's home folder
${workspaceFolder} Path of the folder opened in VS Code
${workspaceFolderBasename} Name of the folder opened in VS Code without any slashes (/)
${file} Currently opened file
${fileWorkspaceFolder} Currently opened file's workspace folder
${relativeFile} Currently opened file relative to workspaceFolder
${relativeFileDirname} Currently opened file's dirname relative to workspaceFolder
${fileBasename} Currently opened file's basename
${fileBasenameNoExtension} Currently opened file's basename with no file extension
${fileExtname} Currently opened file's extension
${fileDirname} Currently opened file's folder path
${fileDirnameBasename} Currently opened file's folder name
${cwd} Task runner's current working directory upon the startup of VS Code
${lineNumber} Currently selected line number in the active file
${columnNumber} Currently selected column number in the active file
${selectedText} Currently selected text in the active file
${execPath} Path to the running VS Code executable
${defaultBuildTask} Name of the default build task
${pathSeparator} Character used by the operating system to separate components in file paths
${/} Shorthand for ${pathSeparator}

Predefined variables example

Suppose that you have the following conditions:

  1. A file located at /home/your-username/your-project/folder/file.ext opened in your editor;
  2. The directory /home/your-username/your-project opened as your root workspace.

This leads to the following values for each of the variables:

  • ${userHome}: /home/your-username
  • ${workspaceFolder}: /home/your-username/your-project
  • ${workspaceFolderBasename}: your-project
  • ${file}: /home/your-username/your-project/folder/file.ext
  • ${fileWorkspaceFolder}: /home/your-username/your-project
  • ${relativeFile}: folder/file.ext
  • ${relativeFileDirname}: folder
  • ${fileBasename}: file.ext
  • ${fileBasenameNoExtension}: file
  • ${fileExtname}: .ext
  • ${fileDirname}: /home/your-username/your-project/folder
  • ${fileDirnameBasename}: folder
  • ${lineNumber}: line number of the cursor
  • ${columnNumber}: column number of the cursor
  • ${selectedText}: text selected in your code editor
  • ${execPath}: location of Code.exe
  • ${pathSeparator}: / on macOS or linux, \ on Windows
Tip

Use IntelliSense inside string values for tasks.json and launch.json to get a full list of predefined variables.

Variables scoped per workspace folder

By appending the root folder's name to a variable (separated by a colon), it is possible to reach into sibling root folders of a workspace. Without the root folder name, the variable is scoped to the same folder where it is used.

For example, in a multi root workspace with folders Server and Client, a ${workspaceFolder:Client} refers to the path of the Client root.

Environment variables

You can reference environment variables with the ${env:Name} syntax. For example, ${env:USERNAME} references the USERNAME environment variable.

{
  "type": "node",
  "request": "launch",
  "name": "Launch Program",
  "program": "${workspaceFolder}/app.js",
  "cwd": "${workspaceFolder}",
  "args": ["${env:USERNAME}"]
}

Configuration variables

To reference VS Code settings (configurations), use the ${config:Name} syntax. For example, ${config:editor.fontSize} references the editor.fontSize setting.

Command variables

You can use any VS Code command as a variable with the ${command:commandID} syntax.

A command variable is replaced with the (string) result from the command evaluation. The implementation of a command can range from a simple calculation with no UI, to some sophisticated functionality based on the UI features available via VS Code's extension API. If the command returns anything other than a string, then the variable replacement will not complete. Command variables must return a string.

An example of this functionality is in VS Code's Node.js debugger extension, which provides an interactive command extension.pickNodeProcess for selecting a single process from the list of all running Node.js processes. The command returns the process ID of the selected process. This makes it possible to use the extension.pickNodeProcess command in an Attach by Process ID launch configuration in the following way:

{
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Attach by Process ID",
      "processId": "${command:extension.pickNodeProcess}"
    }
  ]
}

When using a command variable in a launch.json configuration, the enclosing launch.json configuration is passed as an object to the command via an argument. This enables commands to know the context and parameters of the specific launch.json configuration when they are called.

Input variables

Command variables are already powerful but they lack a mechanism to configure the command being run for a specific use case. For example, it is not possible to pass a prompt message or a default value to a generic "user input prompt".

This limitation is solved with input variables, which have the syntax ${input:variableID}. The variableID refers to entries in the inputs section of launch.json and tasks.json, where additional configuration attributes are specified. Nesting of input variables is not supported.

The following example shows the overall structure of a tasks.json that makes use of input variables:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "task name",
      "command": "${input:variableID}"
      // ...
    }
  ],
  "inputs": [
    {
      "id": "variableID",
      "type": "type of input variable"
      // type specific configuration attributes
    }
  ]
}

Currently VS Code supports three types of input variables:

  • promptString: shows an input box to get a string from the user.
  • pickString: shows a Quick Pick dropdown to let the user select from several options.
  • command: runs an arbitrary command.

Each type requires additional configuration attributes:

promptString:

  • description: shown in the quick input, provides context for the input.
  • default: default value that will be used if the user doesn't enter something else.
  • password: set to true to input with a password prompt that will not show the typed value.

pickString:

  • description: shown in the quick pick, provides context for the input.
  • options: an array of options for the user to pick from.
  • default: default value that will be used if the user doesn't enter something else. It must be one of the option values.

An option can be a string value or an object with both a label and value. The dropdown will display label: value.

command:

  • command: runs a command on variable interpolation.
  • args: optional option bag passed to the command's implementation.

Below is an example of a tasks.json that illustrates the use of inputs using Angular CLI:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "ng g",
      "type": "shell",
      "command": "ng",
      "args": ["g", "${input:componentType}", "${input:componentName}"]
    }
  ],
  "inputs": [
    {
      "type": "pickString",
      "id": "componentType",
      "description": "What type of component do you want to create?",
      "options": [
        "component",
        "directive",
        "pipe",
        "service",
        "class",
        "guard",
        "interface",
        "enum"
      ],
      "default": "component"
    },
    {
      "type": "promptString",
      "id": "componentName",
      "description": "Name your component.",
      "default": "my-new-component"
    }
  ]
}

Running the example:

Inputs Example

The following example shows how to use a user input variable of type command in a debug configuration that lets the user pick a test case from a list of all test cases found in a specific folder. It is assumed that some extension provides an extension.mochaSupport.testPicker command that locates all test cases in a configurable location and shows a picker UI to pick one of them. The arguments for a command input are defined by the command itself.

{
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Run specific test",
      "program": "${workspaceFolder}/${input:pickTest}"
    }
  ],
  "inputs": [
    {
      "id": "pickTest",
      "type": "command",
      "command": "extension.mochaSupport.testPicker",
      "args": {
        "testFolder": "/out/tests"
      }
    }
  ]
}

Command inputs can also be used with tasks. In this example, the built-in Terminate Task command is used. It can accept an argument to terminate all tasks.

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Terminate All Tasks",
      "command": "echo ${input:terminate}",
      "type": "shell",
      "problemMatcher": []
    }
  ],
  "inputs": [
    {
      "id": "terminate",
      "type": "command",
      "command": "workbench.action.tasks.terminate",
      "args": "terminateAll"
    }
  ]
}

Common questions

Details of variable substitution in a debug configuration or task

Variable substitution in debug configurations or tasks is a two pass process:

  • In the first pass, all variables are evaluated to string results. If a variable occurs more than once, it is only evaluated once.
  • In the second pass, all variables are substituted with the results from the first pass.

A consequence of this is that the evaluation of a variable (for example, a command-based variable implemented in an extension) has no access to other substituted variables in the debug configuration or task. It only sees the original variables. This means that variables cannot depend on each other (which ensures isolation and makes substitution robust against evaluation order).

Is variable substitution supported in User and Workspace settings?

The predefined variables are supported in a select number of setting keys in settings.json files such as the terminal cwd, env, shell and shellArgs values. Some settings like window.title have their own variables:

  "window.title": "${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}"

Refer to the comments in the Settings editor (?, (Windows, Linux Ctrl+,)) to learn about setting-specific variables.

Why isn't ${workspaceRoot} documented?

The variable ${workspaceRoot} was deprecated in favor of ${workspaceFolder} to better align with Multi-root Workspace support.

Why aren't variables in tasks.json being resolved?

Not all values in tasks.json support variable substitution. Specifically, only command, args, and options support variable substitution. Input variables in the inputs section will not be resolved as nesting of input variables is not supported.

How can I know a variable's actual value?

One easy way to check a variable's runtime value is to create a VS Code task to output the variable value to the console. For example, to see the resolved value for ${workspaceFolder}, you can create and run (Terminal > Run Task) the following simple 'echo' task in tasks.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "echo",
      "type": "shell",
      "command": "echo ${workspaceFolder}"
    }
  ]
}
香膏是什么 理想主义者是什么意思 球蛋白高是什么原因 植树造林的好处是什么 应届生是什么意思
属鼠的幸运色是什么颜色 闻所未闻是什么意思 姜为什么不能晚上吃 对等是什么意思 什么不得
桃酥为什么叫桃酥 什么东西不能一起吃 我国最早的中医学专著是什么 腰椎退行性变什么意思 入殓师是做什么的
甲减喝什么药 lsp是什么 陈皮泡水喝有什么好处 冉是什么意思 嘴唇紫黑是什么原因
前列腺炎吃什么药效果好见效快hcv8jop4ns8r.cn 喝酒上头是什么原因hcv8jop9ns9r.cn 脱发吃什么药hcv8jop3ns0r.cn 夜盲症是什么症状hcv9jop1ns4r.cn 冰毒是什么hcv9jop1ns6r.cn
栗子不能和什么一起吃hcv7jop5ns6r.cn insun是什么牌子hcv7jop9ns1r.cn 转氨酶升高有什么症状hcv8jop6ns8r.cn 手术室为什么那么冷hcv8jop8ns2r.cn 肺热咳嗽吃什么药hcv9jop3ns2r.cn
公历是什么历hcv7jop9ns7r.cn kai是什么意思gysmod.com 嘴唇有黑斑是什么病hcv9jop5ns2r.cn 呼吸不顺畅是什么原因hcv9jop3ns9r.cn 煮牛肉放什么容易烂hcv9jop3ns0r.cn
笑气是什么气体hcv7jop6ns1r.cn 湿气严重吃什么药好得快hcv8jop0ns2r.cn 检查怀孕要做什么检查dajiketang.com xsh是什么意思xianpinbao.com 做梦梦见钓鱼是什么意思hcv8jop2ns4r.cn
百度