VSCodelaunch.json中的各种替换变量指的是什么意思-成都快上网建站

VSCodelaunch.json中的各种替换变量指的是什么意思

本文将为大家详细介绍“VSCode launch.json中的各种替换变量指的是什么意思”,内容步骤清晰详细,细节处理妥当,而小编每天都会更新不同的知识点,希望这篇“VSCode launch.json中的各种替换变量指的是什么意思”能够给你意想不到的收获,请大家跟着小编的思路慢慢深入,具体内容如下,一起去收获新知识吧。

在成都网站设计、成都网站制作过程中,需要针对客户的行业特点、产品特性、目标受众和市场情况进行定位分析,以确定网站的风格、色彩、版式、交互等方面的设计方向。创新互联还需要根据客户的需求进行功能模块的开发和设计,包括内容管理、前台展示、用户权限管理、数据统计和安全保护等功能。

vscode有什么用

Visual Studio Code 是一个运行于 OS X,Windows和 Linux 之上的,针对于编写现代 web 和云应用的跨平台编辑器,它为开发者们提供了对多种编程语言的内置支持,并且正如 Microsoft 在Build 大会的 keynote 中所指出的,这款编辑器也会为这些语言都提供了丰富的代码补全和导航功能。

VS Code supports variable substitution inside strings in launch.json and has the following predefined variables:

  • ${workspaceFolder} - the path of the folder opened in VS Code

  • ${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 workspaceRoot

  • ${fileBasename} - the current opened file's basename

  • ${fileBasenameNoExtension} - the current opened file's basename with no file 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} syntax (for example, ${env:PATH}). Be sure to match the environment variable name's casing, for example ${env:Path} on Windows.

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

You can reference VS Code settings and commands using the following syntax:

  • ${config:Name} - example: ${config:editor.fontSize}

  • ${command:CommandID} - example: ${command:explorer.newFolder}

在vscode中定义了一些变量,在配置任务脚本时,可能会用到。本文以launch.json脚本为例,介绍各个变量的含义。

假设当前workspace的路径为:"C:\Users\admin\Desktop\test",workspace文件夹下的结构如下(+表示下一层):

C:\Users\admin\Desktop\test

+.vscode

  ++tasks.json

  ++launch.json

+main.cpp

${workspaceFolder} :表示当前workspace文件夹路径,也即C:\Users\admin\Desktop\test

${workspaceRootFolderName}:表示workspace的文件夹名,也即test

${file}:文件自身的绝对路径,也即C:\Users\admin\Desktop\test\.vscode\launch.json

${relativeFile}:文件在workspace中的路径,也即.vscode\launch.json

${fileBasenameNoExtension}:当前文件的文件名,不带后缀,也即launch

${fileBasename}:当前文件的文件名,launch.json

${fileDirname}:文件所在的文件夹路径,也即C:\Users\admin\Desktop\test\.vscode

${fileExtname}:当前文件的后缀,也即.json

${lineNumber}:当前文件光标所在的行号

${env:PATH}:系统中的环境变量

如果你能读到这里,小编希望你对“VSCode launch.json中的各种替换变量指的是什么意思”这一关键问题有了从实践层面最深刻的体会,具体使用情况还需要大家自己动手实践使用过才能领会,如果想阅读更多相关内容的文章,欢迎关注创新互联行业资讯频道!


网站标题:VSCodelaunch.json中的各种替换变量指的是什么意思
文章来源:http://kswjz.com/article/ijiscd.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流