[英]How can I compile and run my Pascal code in VS code?
有沒有辦法可以修改 tasks.json 和 keybingings 來創建用於編譯和運行代碼的快捷方式? 經過大量的谷歌搜索,我想出了這個。 當我按 ctrl+shift+b 時,它會編譯但沒有彈出程序的命令提示符。
"version": "0.1.0",
"isShellCommand": true,
"showOutput": "always",
"command": "cmd",
"args": ["/C"],
"tasks": [
{
"taskName": "Compile",
"suppressTaskName": true,
"isBuildCommand": true,
"args": ["\"fpc ${file}\""]
},
{
"taskName": "Run",
"suppressTaskName": true,
"isBuildCommand": true,
"args": ["\"start $[fileBasenameNoExtension}.exe\""]
}
]
}
帕斯卡還活着,還在踢。 我所說的 Pascal 是現代對象 Pascal 編程,而不是你爸爸的 Pascal。 我一直在為所有平台使用(主要是) Free Pascal制作許多應用程序,使用Lazarus IDE (用於 GUI 應用程序)和 VS Code(用於非 GUI 應用程序)。 現代 Pascal 可以做任何其他語言都可以做的事情。 查看當今的 5 大帕斯卡。
現在……為了能夠在 VS Code 中使用 Pascal。 首先,請務必安裝 Free Pascal。 然后安裝OmniPascal擴展。 並閱讀我的指南Free Pascal 和 VS Code 。 我在其中提供了許多有用的任務來幫助您使用 Pascal,包括代碼格式化。 它是印度尼西亞語,但您可以使用谷歌翻譯以英語(或您喜歡的任何語言)閱讀。
哈。
這是我的tasks.json,效果很好
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "PAS build active file",
"command": "fpc",
"args": [
"${file}"
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
]
}
FreePascal Toolkit是用於開發 FreePascal 應用程序的 VSCode 擴展。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.