本文將為大家詳細(xì)介紹“VSCode launch.json中的各種替換變量指的是什么意思”,內(nèi)容步驟清晰詳細(xì),細(xì)節(jié)處理妥當(dāng),而小編每天都會(huì)更新不同的知識(shí)點(diǎn),希望這篇“VSCode launch.json中的各種替換變量指的是什么意思”能夠給你意想不到的收獲,請(qǐng)大家跟著小編的思路慢慢深入,具體內(nèi)容如下,一起去收獲新知識(shí)吧。
Visual Studio Code 是一個(gè)運(yùn)行于 OS X,Windows和 Linux 之上的,針對(duì)于編寫(xiě)現(xiàn)代 web 和云應(yīng)用的跨平臺(tái)編輯器,它為開(kāi)發(fā)者們提供了對(duì)多種編程語(yǔ)言的內(nèi)置支持,并且正如 Microsoft 在Build 大會(huì)的 keynote 中所指出的,這款編輯器也會(huì)為這些語(yǔ)言都提供了豐富的代碼補(bǔ)全和導(dǎo)航功能。
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中定義了一些變量,在配置任務(wù)腳本時(shí),可能會(huì)用到。本文以launch.json腳本為例,介紹各個(gè)變量的含義。
假設(shè)當(dāng)前workspace的路徑為:"C:\Users\admin\Desktop\test",workspace文件夾下的結(jié)構(gòu)如下(+表示下一層):
C:\Users\admin\Desktop\test
+.vscode
++tasks.json
++launch.json
+main.cpp
${workspaceFolder} :表示當(dāng)前workspace文件夾路徑,也即C:\Users\admin\Desktop\test
${workspaceRootFolderName}:表示workspace的文件夾名,也即test
${file}:文件自身的絕對(duì)路徑,也即C:\Users\admin\Desktop\test\.vscode\launch.json
${relativeFile}:文件在workspace中的路徑,也即.vscode\launch.json
${fileBasenameNoExtension}:當(dāng)前文件的文件名,不帶后綴,也即launch
${fileBasename}:當(dāng)前文件的文件名,launch.json
${fileDirname}:文件所在的文件夾路徑,也即C:\Users\admin\Desktop\test\.vscode
${fileExtname}:當(dāng)前文件的后綴,也即.json
${lineNumber}:當(dāng)前文件光標(biāo)所在的行號(hào)
${env:PATH}:系統(tǒng)中的環(huán)境變量
如果你能讀到這里,小編希望你對(duì)“VSCode launch.json中的各種替換變量指的是什么意思”這一關(guān)鍵問(wèn)題有了從實(shí)踐層面最深刻的體會(huì),具體使用情況還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想閱讀更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司行業(yè)資訊頻道!
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)建站chinadenli.net,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
文章名稱:VSCodelaunch.json中的各種替換變量指的是什么意思-創(chuàng)新互聯(lián)
標(biāo)題鏈接:http://chinadenli.net/article18/desjdp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)、定制開(kāi)發(fā)、建站公司、外貿(mào)建站、Google、網(wǎng)站導(dǎo)航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容