[英]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.