VSCode tasks.json中的各种替换变量的意思 ${workspaceFolder} ${file} ${fileBasename} ${fileDirname}等
When authoring tasks configurations, it is often useful to have a set of predefined common variables. VS Code supports variable substitution inside strings in the tasks.json file and has the following predefined variables:
- ${workspaceFolder} the path of the workspace folder that contains the tasks.json file
- ${workspaceRootFolderName} the name of the folder opened in VS Code without any slashes (/)
- ${file} the current opened file
- ${relativeFile} the current opened file relative to the workspace folder containing the file
- ${fileBasename} the current opened file's basename
- ${fileBasenameNoExtension} the current opened file's basename without the extension
- ${fileDirname} the current opened file's dirname
- ${fileExtname} the current opened file's extension
- ${cwd} the task runner's current working directory on startup
- ${lineNumber} the current selected line number in the active file
You can also reference environment variables through ${env:Name} (for example, ${env:PATH}). Be sure to match the environment variable name's casing, for example ${env:Path} on Windows.
Below is an example of a custom task configuration that passes the current opened file to the TypeScript compiler.
{
"taskName": "TypeScript compile",
"type": "shell",
"command": "tsc ${file}",
"problemMatcher": [
"$tsc"
]
}
部分翻译:(来自互联网)
${workspaceRoot}
当前打开的文件夹的绝对路径+文件夹的名字
${workspaceRootFolderName} 当前打开的文件夹的名字
${file}当前打开正在编辑的文件名,包括绝对路径,文件名,文件后缀名
${relativeFile}从当前打开的文件夹到当前打开的文件的路径
如 当前打开的是test文件夹,当前的打开的是main.c,并有test / first / second / main.c
那么此变量代表的是 first / second / main.c
${fileBasename}
当前打开的文件名+后缀名,不包括路径
${fileBasenameNoExtension}
当前打开的文件的文件名,不包括路径和后缀名
${fileDirname}
当前打开的文件所在的绝对路径,不包括文件名
${fileExtname}
当前打开的文件的后缀名
${cwd}
the task runner's current working directory on startup
不知道怎么描述,这是原文解释,
跟
cmd 里面的 cwd 是一样的
${lineNumber}
当前打开的文件,光标所在的行数
VSCode tasks.json中的各种替换变量的意思 ${workspaceFolder} ${file} ${fileBasename} ${fileDirname}等的更多相关文章
- VSCode 在.vscode/launch.json中设置启动时的参数
如下脚本设置启动参数,如题,在.vscode/launch.json文件中,红色部分设置运行参数 { // Use IntelliSense to learn about possible attri ...
- VSCode调试Html中的脚本 vscode前端常用插件推荐,搭建JQuery、Vue等开发环境 vsCode 添加浏览器调试和js调试的方法总结 VS Code - Debugger for Chrome调试js
一.背景 使用Visual Studio Code写了一个简单的Html页面,想调试下其中script标签里的javascript代码,网上查了一通,基本都是复制粘贴或者大同小异的文章,就是要安装De ...
- vscode中关于launch.json和tasks.json的变量说明
vscode是一个轻量级的文本编辑器,但是它的拓展插件可以让他拓展成功能齐全的IDE,这其中就靠的是tasks.json和launch.json的配置 这两个json文件的相关变量是vscode特有的 ...
- 40 VSCode下.json文件的编写——(1) linux/g++ (2).json中参数与预定义变量的意义解释
0 引言 转入linux/VSCode编程之后,迫切了解到有必有较为系统地学习一下VSCode中相关配置文件的写法.下面将分为 linux/g++编译指令..json文件关键词/替换变量的意义.编译链 ...
- vscode中启动浏览器的tasks.json
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tas ...
- 【RMAN】RMAN脚本中使用替换变量
[RMAN]RMAN脚本中使用替换变量--windows 下rman全备脚本 一.1 BLOG文档结构图 一.2 前言部分 一.2.1 导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也 ...
- SQL*Plus中替换变量与定义变量
替换变量 SQL*Plus中的替换变量又叫替代变量,它一般用来临时存储相关数据:在SQL语句之间传递值.一般使用&或&&前缀来指定替换变量. 关于使用替换变量,一般是利用其创建 ...
- 读取Json,并替换json中的指定字符
string jsonfile = @"E:\history.json";//JSON文件路径 using (System.IO.FileStream file = new Fil ...
- js中eval详解,用Js的eval解析JSON中的注意点
先来说eval的用法,内容比较简单,熟悉的可以跳过eval函数接收一个参数s,如果s不是字符串,则直接返回s.否则执行s语句.如果s语句执行结果是一个值,则返回此值,否则返回undefined. 需要 ...
随机推荐
- 说几个python与c区别的地方以及静态变量,全局变量的区别
一: python代码: a = 2 def b(): print a a = 4 print a b() 在b函数中,有a=4这样的代码,说明a是函数b内部的局部变量,而不是外部的那个值为2的全局变 ...
- mysql 5.7 ~ 新特性
mysql 5.7特性 简介:mysql 5.7内存和线程性能方面的优化一 细节优化 参数: 1 innodb_buffer_pool 改进 innodb_buffer_pool可以动态扩大, ...
- cmake使用示例与整理总结
转自: http://blog.csdn.net/wzzfeitian/article/details/40963457/ 本文代码托管于github https://github.com/carl ...
- C++获取当前所有进程的完整路径
实现代码 #include <stdio.h> #include <windows.h> #include <tlhelp32.h> #include <st ...
- Python爬虫-爬取糗事百科段子
闲来无事,学学python爬虫. 在正式学爬虫前,简单学习了下HTML和CSS,了解了网页的基本结构后,更加快速入门. 1.获取糗事百科url http://www.qiushibaike.com/h ...
- git获取内核源码的方法
[转]http://www.360doc.com/content/17/0410/16/23107068_644444795.shtml 1. 前言 本文主要讲述ubuntu下通过git下载linux ...
- grep用法【转】
简介 grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它 ...
- n个随机变量中第k小值的期望
Problem 有\(n\)个相互独立的取值在\([0,1]\)的随机变量,问其中第\(k\)小的变量期望是多少? Solution 之前pkuwc的神仙找我换友链,让我受宠若惊.. 我今天突然翻到他 ...
- saltstack自动化运维系列11基于etcd的saltstack的自动化扩容
saltstack自动化运维系列11基于etcd的saltstack的自动化扩容 自动化运维-基于etcd加saltstack的自动化扩容# tar -xf etcd-v2.2.1-linux-amd ...
- appium运行报错java.net.SocketException: socket write error
这个错我调了 快两天一点头绪没有,脚本正常跑没问题,但是就是控制台输出信息报错,没法定位问题在哪.报错如图: 虽然这个报错不影响测试结果,但是本人有强迫症,一定要查出究竟: 我的尝试: 1.那天试验, ...