最近想弄Sublime Text 3寫Processing,但由於各種不知名原因導致無法編譯,就想着換自去年以來超火的VScode試一下,還真給我試成功了。
1、下載https://code.visualstudio.com
2、打開VSC,左側邊欄最下方Extensions,搜索Processing Language並安裝Install。
順便安裝Beautify,用來自動格式化代碼
3、打開一個用Processing新建的Sketch(一個文件夾+一個pde文檔)
4、寫一個簡單的HelloWorld
void setup() { size(400,400); } void draw() { ellipse(width/2,height/2,100,100); }
5、選擇編譯並運行(shift+command+B)
6、此時,VScode會蹦一個tasks.json的東西出來,把它里面的內容替換成下面的:
"version": "2.0.0",
"tasks": [{
"label": "Run Sketch",
"type": "shell",
"group": {
"kind": "build",
"isDefault": true
},
"command": "${config:processing.path}",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
},
"args": [
"--force",
"--sketch=${workspaceRoot}",
"--output=${workspaceRoot}/out",
"--run"],
"windows": {
"args": [ "--force",
"--sketch=${workspaceRoot}",
"--output=${workspaceRoot}\\out",
"--run"]
}
}
]
7、然后再Shift+command+B運行,如果一切正常,就會出現下面的畫面。