新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

VSCodelaunch.json中的各种替换变量指的是什么意思-创新互联

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

沂水网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站设计等网站项目制作,到程序开发,运营维护。创新互联2013年开创至今到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联。

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中的各种替换变量指的是什么意思”这一关键问题有了从实践层面最深刻的体会,具体使用情况还需要大家自己动手实践使用过才能领会,如果想阅读更多相关内容的文章,欢迎关注创新互联网站建设公司行业资讯频道!

另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页标题:VSCodelaunch.json中的各种替换变量指的是什么意思-创新互联
当前链接:http://www.wjwzjz.com/article/desjdp.html
在线咨询
服务热线
服务热线:028-86922220
TOP